当我调用我的函数从我的数据库中删除一行时:
public void deleteRow(int rowId) {
getWritableDatabase().delete(DatabaseHelper.orderTable, "id="+rowId,null);
我在 logcat 中收到很多错误消息:
06-02 16:32:14.356: E/WindowManager(2770): Activity com.Sagi.MyOrders.FindOrder has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@44f50540 that was originally added here
06-02 16:32:14.356: E/WindowManager(2770): android.view.WindowLeaked: Activity com.Sagi.MyOrders.FindOrder has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@44f50540 that was originally added here
06-02 16:32:14.356: E/WindowManager(2770): at android.view.ViewRoot.<init>(ViewRoot.java:247)
06-02 16:32:14.356: E/WindowManager(2770): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
06-02 16:32:14.356: E/WindowManager(2770): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
06-02 16:32:14.356: E/WindowManager(2770): at android.view.Window$LocalWindowManager.addView(Window.java:424)
06-02 16:32:14.356: E/WindowManager(2770): at android.app.Dialog.show(Dialog.java:241)
06-02 16:32:14.356: E/WindowManager(2770): at com.Sagi.MyOrders.FindOrder.alert_editlist(FindOrder.java:56)
06-02 16:32:14.356: E/WindowManager(2770): at com.Sagi.MyOrders.FindOrder.onItemLongClick(FindOrder.java:138)
06-02 16:32:14.356: E/WindowManager(2770): at android.widget.AbsListView.performLongPress(AbsListView.java:1753)
06-02 16:32:14.356: E/WindowManager(2770): at android.widget.AbsListView.access$600(AbsListView.java:72)
06-02 16:32:14.356: E/WindowManager(2770): at android.widget.AbsListView$CheckForLongPress.run(AbsListView.java:1711)
06-02 16:32:14.356: E/WindowManager(2770): at android.os.Handler.handleCallback(Handler.java:587)
06-02 16:32:14.356: E/WindowManager(2770): at android.os.Handler.dispatchMessage(Handler.java:92)
06-02 16:32:14.356: E/WindowManager(2770): at android.os.Looper.loop(Looper.java:123)
06-02 16:32:14.356: E/WindowManager(2770): at android.app.ActivityThread.main(ActivityThread.java:4627)
06-02 16:32:14.356: E/WindowManager(2770): at java.lang.reflect.Method.invokeNative(Native Method)
06-02 16:32:14.356: E/WindowManager(2770): at java.lang.reflect.Method.invoke(Method.java:521)
06-02 16:32:14.356: E/WindowManager(2770): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-02 16:32:14.356: E/WindowManager(2770): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-02 16:32:14.356: E/WindowManager(2770): at dalvik.system.NativeStart.main(Native Method)
我寻找了一个打开的光标或一个数据库,但我找不到任何东西。函数返回后,有:
finish();
这是我的 alertDialog 创建者:
private void alert_editlist(final int id) {
// TODO Auto-generated method stub
final CharSequence[] items = {"Edit", "Delete"};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("What do you want to do?");
builder.setSingleChoiceItems(items, -1, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
if (items[item]=="Edit") {
}
else if(items[item]=="Delete"){
finish();
}
finish();
}
});
AlertDialog alert = builder.create();
alert.show();
}
谢谢 !!!