2012-04-03 17 views
0

我的代碼有問題。我實現了一個微調的提示對話框,但是當我表明它是白色和日誌貓說:微調對話框中的無效語句在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> 
+0

活動首次創建時是否引發錯誤?或者當你在其他地方導航並回來? – Phix 2012-04-03 16:10:40

回答

0

我要去無路可退,建議大家有一個無效的數據庫查詢語句周圍某處「listdb.update()」。

編輯:一些快速搜索建議它可能也可能與this或更可能this(不正確地關閉遊標或數據庫)有關。

+0

謝謝,但沒有問題。我說我的微調工作,但看起來全白。它不需要我的數據庫中的參數。 – Twing90 2012-04-03 16:15:46