对话框中的微调器在fillwindow()中有无效语句



我的代码有问题。我已经在警报对话框中实现了一个微调器,但当我显示它是白色时,日志猫会说:

04-03 15:56:17.119: E/Cursor(460): Invalid statement in fillWindow()

我能做些什么来修理它??这就是代码。我复制了它工作的另一个活动。但在这项活动中,情况并非如此。为什么?

Cursor sp_curs;
    Dialog viewDialog = new Dialog(this);
    viewDialog.getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
    viewDialog.setTitle("Select Category");
    LayoutInflater li = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View dialogView = li.inflate(R.layout.spinner_alert, null);
    Spinner spinnercategory = (Spinner) dialogView
            .findViewById(R.id.spinQ);
    //Apriamo il db creato tramite MissioniDb a cui passo il contesto della classe attuale ovvero Lista_Missioni
    SpinnerDb sdb=new SpinnerDb(getApplicationContext());
    //apriamo il db
    sdb.open();  
    //Chiamo la Query che in questo caso è un all
    sp_curs=sdb.fetchSPINNER();
    startManagingCursor(sp_curs);
    // create an array to specify which fields we want to display
    String[] from = new String[]{SpinnerDb.SpinnerMetaData.SPINNER_CAT_KEY};
    // create an array of the display item we want to bind our data to
    int[] to = new int[]{android.R.id.text1};
    // create simple cursor adapter
    SimpleCursorAdapter spadapter =
      new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, sp_curs, from, to );
    spadapter.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item );
    //stopManagingCursor(sp_curs);
    //Chiudo il db perchè ho finito di riempire la mia list view
    sdb.close();
    spadapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinnercategory.setAdapter(spadapter);
    viewDialog.setContentView(dialogView);
    viewDialog.show();
    spinnercategory.setOnItemSelectedListener(new OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, View arg1,
                int arg2, long arg3) {
            new_categoria = parent.getSelectedItem().toString();
            listdb.update("7", "Category", new_categoria, "2");
            c.requery();
        }
        public void onNothingSelected(AdapterView<?> arg0) {
        }
    });

这是我的微调器xml

<?xml version="1.0" encoding="utf-8"?>  
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:paddingLeft="10dip"
>
<Spinner 
android:id="@+id/spinQ" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"
/> 

</LinearLayout>

我要冒险,建议您在"listdb.update()"附近有一个无效的数据库查询语句。

编辑:一些快速搜索表明,它也可能与此有关,或者更有可能与此相关(不正确地关闭光标或数据库)。

最新更新