Java SimpleCursorAdapter不';在listview中不返回任何对象
我在我的应用程序中使用SimpleCrsorAdapter从db中获取行,我没有收到任何错误,我尝试将值放入db中,但我看不到任何填充的listview。为了更好的解释,我在下面发布了我的代码 FragmentTab2.javaJava SimpleCursorAdapter不';在listview中不返回任何对象,java,android,listview,simplecursoradapter,Java,Android,Listview,Simplecursoradapter,我在我的应用程序中使用SimpleCrsorAdapter从db中获取行,我没有收到任何错误,我尝试将值放入db中,但我看不到任何填充的listview。为了更好的解释,我在下面发布了我的代码 FragmentTab2.java @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view =
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragmenttab2, container, false);
d= new Database(getActivity());
Cursor c = d.getBarcode();
CursorLoader(c);
String from[] = {Codice.DATI_ID,
Codice.DATI_BARCODE};
int to[] = {R.id.record_id,
R.id.record_barcode};
@SuppressWarnings("deprecation")
SimpleCursorAdapter sca = new SimpleCursorAdapter(view.getContext(),
R.layout.singolo_elemento_card,
c, from, to);
cardBarcode = (ListView) view.findViewById(R.id.barcode_list);
cardBarcode.setAdapter(sca);
cardBarcode.setClickable(true);
cardBarcode.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View v, int position,
long id) {
}
});
return view;
}
private void CursorLoader(Cursor c) {
// TODO Auto-generated method stub
}
使用
getBarcode
中的DatabaseUtils.dumpCursor()
在logcatshow上查看它CursorLoader
方法代码@ρ∑ρєK CursorLoader方法位于底部,为空,并且您在logcat上看到的是什么?@pskink 08-05 12:31:46.975:I/System.out(15604):>>>>>>转储游标android.database.sqlite。SQLiteCursor@408a39a008-05 12:31:46.975:I/System.out(15604):使用DatabaseUtils.dumpCursor()
在getBarcode
中,在logcatshow上查看它CursorLoader
方法代码也@ρ∑ρρK CursorLoader方法在底部,是空的,您在logcat上看到的是什么?@pskink 08-05 12:31:46.975:I/System.out(15604):>>>>>>转储游标android.database.sqlite。SQLiteCursor@408a39a008-05 12:31:46.975:I/系统输出(15604):
public Cursor getBarcode(){
Cursor c= db.query(Codice.TABLE_CARD, null ,
null ,
null ,
null ,
null ,
null );
return c;
}