我的代码有问题。我在一个警告对话框中实现了一个微调器,但当我显示它是白色时,日志猫说:
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>