Android - Passing Value from ListView to a new Activity? -
I have a list view that shows a list of names. When you choose a name, I want to send the person's identity to the next profile (profile) and recover their data based on my ID.
I am able to load View Profile, but find out how to pass ID on profile from ListView here is how I am loading profile:
lv.setOnItemClickListener (new OnItemClickListener () {public void onItemClick (parent, view view, integer position, long ID) {intent MyIntent = new intent (see.Titiventext), subview .class); // When a row is raised, the subview is class. Krenaktivetivfor Reslt (Maiainntent, 0); // display Sbvikclas}}) loads;
An intent contains additional bundles:
< Code> myIntent = new intent (view.getContext (), SubView.class); MyIntent.putExtra ("id", id); StartActivityForResult (myIntent, 0); // display subView.class
In the oncreate method of your profile activity you can use additional:
int id = getIntent (). GetIntExtra ("id");
Comments
Post a Comment