Getting error while displayin data.
I have doing small application in android.During this application, i have suffer this problem:
I search the keyword using "oh" then i listing in to listview using this code.
nameList.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
try {
Intent intent = new Intent(Search.this,
SearchDetails.class);
/*
* Cursor cursor = (Cursor) adapter.getItem(position);
* intent.putExtra("JOK_ID",
* cursor.getInt(cursor.getColumnIndex("_id")));
*/
intent.putExtra("id", id);
intent.putExtra("position", position);
Log.d(TAG, " I.." + id);
Log.d(TAG, " P.." + position);
startActivity(intent);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
for example like this enter image description here
Now, if I click oham then display just like this: enter image description here
Finally, I want to , If i click previous button then display john and Next to display krackohm. And count total number of searched names. I have try this code for next button:
Cursor cursor = db.rawQuery("SELECT _id, name FROM std WHERE _id = ?",
new String[]{""+Id});
if (cursor.getCount() == 1)
{
cursor.moveToFirst();
...body
}
Be the first to comment