android - how to pull strings from an array adapted listview for a clicked list item -
Ok so I have an array shield ListView (array adapting another class) .. I just click The listener got the job done for the list, but now I want to set it up so that when I click on an item it pulls the wire from the item clicked and it is based on the intent for a new activity. I understand but intent. Do not use putextra to im sure how the item is B i .. to pull the right strings to click on my code is below .. im just lost to be honest
// Start ListView lstTest = (ListView) FindViewById (R.id.lstText); // Start ArrayList alrts = New Arrestist & lt; Alert & gt; (); // Start array adapter notice Listitems.xml layout array Krenadaptr = new Alrtadaptr (This R. Leautklilistims, Artrt); // Set the adapter as the adapter for the list lstTest.setAdapter (arrayAdapter); (New AdapterView.OnItemClickListener () {public void onItemClick (AdapterView adapterView, to see whole item, click to the long arg3) {Intent intent = new Intent (HomePageActivity.this, PromotionActivity.class // list lstTest.setOnItemClickListener listener Set); end (); initial (intent);}});
My warning class ..
public class alerts {public string cityid; Public string promoter; Public string promosource content; Public string promocont; Public string promotion; Public string locationid; Public string cover; @Override public string toString () {Return "City:" + cityId + "Promoter:" + Promerid + "Short Promotion:" + promoshortcontent + "Promotion:" + promocontent + 'Title: "+ promotitle +' Location: Locationid + 'cover: "+ cover +" $ "; }
}
anddddd my alertsadapter class ..
public class AlertsAdapter extends ArrayAdapter & LT; Alert & gt; {Int Resources; String feedback; Reference Reference; // Early Adapter Public Alert Adapter (Reference Reference, Intro Resources, Listings & lt; Alert & gt; Items) {Super (Reference, Resources, Items); This.resource = resource; } @ Override public view getView (see the status of int, seeviewview, viewGroup parent) {LinearLayout alertView; // Get Current Alert Object Alert al = getItem (status); // Flip the view if (convert = = empty) {alertView = new linear layout (getContext ()); String flatters = context. LAYOUT_INFLATER_SERVICE; LayoutInflator vi; Vi = (layoutInflator) getContext (). GetSystemService (inflater); Vi.inflate (resource, alert view, true); } Else {alertView = (LinearLayout) Convertview; } // Get the text boxes listitem.xml file TextView Tekstpromo = (Tekstwuwu) alerts Vivkfindwubiaiaidi (Arkaidktekstpromo); Text viewerpromotor = (text view) alert. ViewViewPromoter; Text view text place = (text view) alert view.findvibidid (RIDTST location); // Above the text, assign appropriate data to our alert objectPro .et text (al.promocontent); TextPromoter.setText (al.promoterid); TextLocation.setText (al.locationid); See the return warning; }
}
You can use the parameters of onItemClick event
The ultimate name is a complete and readable ultimate antum
(adapterview
This means that you have pos
the ultimate position in the adapter.
What do you have to do:
- Read the value from the adapter
- Use putExtra to signup for intentions
Comments
Post a Comment