Okay so i have a class called viewList. When the item it long pressed the id is looked up of that item in my SQL database. And starts a new activity. How would i transfer this id that is retrieved on long press, to my new activity so it can intern look up the info.
case R.id.lookup_book:
AdapterContextMenuInfo web =
(AdapterContextMenuInfo)item.getMenuInfo();
mDbHelper.fetchinfo(web.id);
Intent v = new Intent(this, bookLookup.class);
startActivity(v);
I would like to pass the web.id to this activity
public class bookLookup extends Activity {
WebView webView;
private DbAdapter mDbHelper;
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.book_browser);
webView = (WebView)findViewById(R.id.webkit);
}
}
In your longClickListener add a metgod to put extra data into the intent. It can be done in this way
In the new activity you can retrieve this extra value by using this
Take care that the myId string that I used to pass and retrieve values between activities should be the same. You can pass multiple items in this way by giving a unique name for each item and use the same name to retrieve them.
You can pass any primitive datatypes in this way. I used long as an example.