这是日志猫。这里的错误似乎是什么?
03-07 03:11:55.841: D/dalvikvm(292): GC_EXTERNAL_ALLOC freed 4085 objects / 243720 bytes in 190ms
03-07 03:11:56.221: D/dalvikvm(292): GC_EXTERNAL_ALLOC freed 303 objects / 16040 bytes in 85ms
03-07 03:12:06.990: W/KeyCharacterMap(292): No keyboard for id 0
03-07 03:12:06.990: W/KeyCharacterMap(292): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
03-07 03:12:07.190: E/Cursor(292): Invalid statement in fillWindow()
从我的 sqliteadapter 获取数据的第一个活动
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.search);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
mySQLiteAdapter = new SQLiteAdapter(this);
mySQLiteAdapter.openToRead();
Cursor cursor = mySQLiteAdapter.queueAll();
startManagingCursor(cursor);
String[] from = new String[]{SQLiteAdapter.KEY_FOODNAME,SQLiteAdapter.KEY_CALORIES};
int[] to = new int[]{R.id.tv1, R.id.tv2};
SimpleCursorAdapter cursorAdapter =
new SimpleCursorAdapter(this, R.layout.row, cursor, from, to);
listContent1.setAdapter(cursorAdapter);
listContent1.setOnItemClickListener(listContentOnItemClickListener);
mySQLiteAdapter.close();
private ListView.OnItemClickListener listContentOnItemClickListener = new ListView.OnItemClickListener(){
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
Cursor cursor = (Cursor) parent.getItemAtPosition(position);
String item_content1 = cursor.getString(cursor.getColumnIndex(SQLiteAdapter.KEY_FOODNAME));
String item_content2 = cursor.getString(cursor.getColumnIndex(SQLiteAdapter.KEY_CALORIES));
arlene = arlene + Integer.parseInt(item_content2);
String item = String.valueOf(" Food Name: " + item_content1 ) + "\n" +
" Calories: " + item_content2;
Toast.makeText(Search.this, item, Toast.LENGTH_LONG).show();
food.setText(item_content1);
calories.setText(String.valueOf(arlene));
Intent myIntent = new Intent(Search.this, Foodlog.class);
Bundle bundle = new Bundle();
bundle.putString("SQLITEDATA1", food.getText().toString());
bundle.putString("SQLITEDATA2", calories.getText().toString());
myIntent.putExtras(bundle);
startActivity(myIntent);
SavePreferences("calories", calories.getText().toString());
LoadPreferences();
获取数据的第二个活动
Bundle bundle = getIntent().getExtras();
if( bundle != null){
String food = bundle.getString("SQLITEDATA1");
String calories = bundle.getString("SQLITEDATA2");
String[] values = new String[] { food, calories }; //That you got from your intent bundle
LVAdapter adapter = new LVAdapter(this, R.layout.foodlist, values);
setListAdapter(adapter);
当我按下后,它将清除我第一次活动的所有列表视图数据