here my coding:- DatabaseHelper.java
public Cursor getinnformationUser(SQLiteDatabase db) {
String a1="f1";
Cursor cursor;
String[] projections = {Menu.NewMenuInfo.MENU_ID, Menu.NewMenuInfo.MENU_NAME, Menu.NewMenuInfo.MENU_PRICE};
String selection = Menu.NewMenuInfo.MENU_ID + "=" + a1;
cursor=db.query(Menu.NewMenuInfo.TABLE_NAME,projections,selection,null,null,null,null);
return cursor;
}
Menu1.java
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.menuset1);
s_id = (TextView) findViewById(R.id.idSet1);
s_name = (TextView) findViewById(R.id.nameSet1);
s_drink = (TextView) findViewById(R.id.drinkSet1);
s_price = (TextView) findViewById(R.id.priceSet1);
set1 = (Button) findViewById(R.id.buttonOrderSet);
userDbHelper = new UserDbHelper(getApplicationContext());
sqLiteDatabase = userDbHelper.getReadableDatabase();
cursor = userDbHelper.getinnformationSet1(sqLiteDatabase);
if (cursor != null){
cursor.moveToFirst();
String id = cursor.getString(0);
String name = cursor.getString(1);
String drink = cursor.getString(2);
String price = cursor.getString(3);
s_id.setText(id);
s_name.setText(name);
s_drink.setText(drink);
s_price.setText(price);
}
}
}
basically i want to display id,name,drink,price according to id="f1". example: if id="f1" then display all the information without using any searching or click button.
when i run this coding the application has stopped