• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Show database item in contextmenu

NotNow

Lurker
Sorry for the title, meant alert dialog

Hey,

For school, I have to develop an Android application.

But back to my question:
In my application I have an database with profiles. I've put the profiles in a textview and those textviews in a listview :o

I've made an alertdialog, where I want to show the title of the profile which was clicked.

Some piece of my code:

@Override
protected void onListItemClick(ListView l, View v, final int position, long id) {
super.onListItemClick(l, v, position, id);
final AlertDialog alertDialog = new AlertDialog.Builder(profiles.this).create();
alertDialog.setIcon(R.drawable.icon);

//position = (int) position.toString(); -- doesnt work
//position = profileDBAdapter.KEY_TITLE; (This is the database item I want to get)
Object o = this.getListAdapter().getItem(position);
String keyword = o.toString();
alertDialog.setTitle(keyword);


alertDialog.setMessage("Do you want to use this profile?");
alertDialog.setButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
setSelection(position);
alertDialog.dismiss();
}
});

I do get something as title in the dialog, but it is not the title i want(KEY_TITLE). I get something like android.database.sqlite.SQLiteCursor@43eebe1 I guess this is the position of the title in the database or something.

I really don't know what I am doing wrong. If someone could help me, I would really appreciate.

Thanks in advance,

Jef
 
Back
Top Bottom