我正在实现一个自定义对话框,以形成一个简单的外观和感觉的屏幕(一旦我开始工作,它可能会变得更加复杂).我有一个xml布局,从R加载一些文本和一个图标.然而,当调用showDialog(int)时,我得到一个力关闭.
我按照开发指南按照说明操作:http://developer.android.com/intl/de/guide/topics/ui/dialogs.html
代码如下:
@Override
protected Dialog onCreateDialog(int id) {
Dialog dialog;
switch(id) {
case DIAG_ABOUT:
dialog = new Dialog(getApplicationContext());
dialog.setContentView(R.layout.aboutdialog);
dialog.setTitle(R.string.about_title);
dialog.setOwnerActivity(this);
break;
default:
dialog = null;
}
return dialog;
}
Run Code Online (Sandbox Code Playgroud)
DIAG_ABOUT定义为 private static final int DIAG_ABOUT = 0;
Log cat显示以下跟踪:
03-04 11:37:08.760: ERROR/AndroidRuntime(726): Uncaught handler: thread main exiting due to uncaught exception
03-04 11:37:08.780: ERROR/AndroidRuntime(726): android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application
03-04 11:37:08.780: ERROR/AndroidRuntime(726): at android.view.ViewRoot.setView(ViewRoot.java:429)
03-04 11:37:08.780: ERROR/AndroidRuntime(726): …
Run Code Online (Sandbox Code Playgroud) I'm trying to track down a memory leak in an application using ANTS profiler. I tracked it down to the Garbage collector where we have a list of objects System.Transactions.SafeIUnknown that sit there forever in the garbage collector, are in the finalizer queue but never get released.
I can find not documentation what so ever on the System.Transactions.SafeIUnknown nor can I determine what would create or reference this, it's nothing intentional on our part.
I am hoping someone out there …
如果我有一个object
实例,我知道它实际上是一个盒装整数,那么我可以简单地将它转换回int,如下所示:
object o = GetSomethingByName("foo");
int i = (int)o;
Run Code Online (Sandbox Code Playgroud)
但是,我实际上并不知道该值是整数.我只知道它可以分配给一个整数.例如,它可能是a byte
,上面的代码会抛出InvalidCastException
这种情况.相反,我必须这样做:
object o = GetSomethingByName("foo");
int i = (int)(byte)o;
Run Code Online (Sandbox Code Playgroud)
该值也可以是a short
或其他可以分配给的值int
.如何概括我的代码来处理所有这些情况(不单独处理每种可能性)?
如何让我的一些JComboBox项目无法选择?我试过这个:
@Override
public Component getListCellRendererComponent(JList list, Object value,
int index. boolean isSelected, boolean cellHasFocus) {
Component comp = super.getListCellRendererComponent(list, value, index,
isSelected, cellHasFocus);
if (not selectable conditions) {
comp.setEnabled(false);
comp.setFocusable(false);
} else {
comp.setEnabled(true);
comp.setFocusable(true);
}
return comp;
}
Run Code Online (Sandbox Code Playgroud)
项目变为灰色,但仍可由用户选择.
我正在使用Pandoc将Markdown转换为Docbook,然后使用Apache FOP将Docbook渲染到XSL-FO .不幸的是,Pandoc使用table-layout ="auto"创建表,而FOP只支持table-layout ="fixed".
是否有支持table-layout ="auto"的XSL-FO渲染器?
我试图让NDepend使用标准的"方法太大"查询的修改版本来识别长方法.
我不想报告开发人员几乎无法控制的长方法,所以我使用DebuggerNonUserCode
属性过滤掉生成的代码InitializeComponent()
.
不幸的是,我仍然得到一些误报,因为报告了生成类型中的方法.问题是虽然类型本身具有DebuggerNonUserCode
属性,但方法没有,因此尽管它们是生成的,但它们仍包含在输出中.
我正在寻找类似于类型和方法之间的连接:给我所有没有DebuggerNonUserCode
属性的类型并对其运行查询,但我无法弄清楚如何在CQL中表达这一点.
对于某些程序集,我可以简单地过滤全名,但不幸的是我们的一些程序集混合了开发人员制作和生成的类型.不幸的IsGeneratedByCompiler
是,在这种情况下也不能使用.
我的查询
WARN IF Count > 0 IN SELECT METHODS WHERE
NbLinesOfCode > 30 AND
!HasAttribute "System.Diagnostics.DebuggerNonUserCodeAttribute" AND
!NameIs "InitializeComponent()"
ORDER BY NbLinesOfCode DESC
Run Code Online (Sandbox Code Playgroud) 我一直致力于规范/ kitchennsink的元语言,可以编译成PHP一段时间了.现在我想开始构建这个东西.在我使用PHP_Lexergenerator和PHP_Parsergenerator实现微型DSL之前,它们已经运行良好,但我之前从未构建任何这样的规模.非常感谢您提供的任何反馈/建议/经验!
我在http://pastebin.com/613mFGsB粘贴了规范.
我正在构建一个API,我打算随着时间的推移升级.在API中包含版本号作为参数是否合理?
我正在Ruby,Java,Erlang和C#中编写一个键/值存储API.我想构建一些可扩展的东西,因为我知道有很多我还没有想到的东西,可能必须在未来加入.但是,我想知道是否有一种干净的方式来执行此操作以及版本号是否也参与其中.
(I'm a beginner)
Run Code Online (Sandbox Code Playgroud)
我的脚本使用标准
$c = 0;
$t = count($array);
while ($c < $t) {
$blah = $array[$c];
++$c;
}
Run Code Online (Sandbox Code Playgroud)
相当广泛.但是我遇到了一个我需要的情况,array_diff
它打破了所有地狱,因为现在数字键有间隙.我Undefined offset
到处都是错误.
如何重置阵列的数字键?数组中对象的顺序无关紧要.