How to pull strings from an array adapted listview for a clicked list item?

You need to use the onItemClick event's parameters a full more readable param enum with param name is (AdapterView parent, View view, int pos, long id) that means you have the pos param that indicated the position in the adapter What you have to do is: jump to pos in the adapter read out the values from the adapter use putExtra to signup for the intent.

You need to use the onItemClick event's parameters a full more readable param enum with param name is (AdapterView parent, View view, int pos, long id) that means you have the pos param that indicated the position in the adapter. What you have to do is: jump to pos in the adapter read out the values from the adapter use putExtra to signup for the intent.

– dootcher Aug 4 '10 at 19:35 ArrayAdapter has a getItem method you can use to get the item at pos. That is probably a String, so you are done also with step 2.It will be something like : String myItem = HomePageActivity.this.arrayAdapter. GetItem(item) – Pentium10 Aug 4 '10 at 20:16 k if im understanding that code right then that would work for a listview that was populated by list items with only 1 corresponding string each.. however I neglected to mention that each list item has multiple strings corresponding to it.. check my code above that I just added.. its my Alerts class and my AlertsAdapter class that extends ArrayAdapter so I imagine this makes it a bit more complex.. sorry :-/ – dootcher Aug 4 '10 at 20:31 You are already doing the code you need in getView().

Alerts al = getItem(position);textPromo. SetText(al. Promocontent); textPromoter.

SetText(al. Promoterid); textLocation. SetText(al.

Locationid); – Pentium10 Aug 4 '10 at 20:48 but isnt that getItem used to pull certain strings from the alerts class and send them to my homepageactivity class (the first block of text up there) for every item in the list? Im needing to pull the corresponding strings that were received from the alertsadapater class for a specific item in the list.. correct me if im wrong cuz you gotta remember ive only been at this for a week :) – dootcher Aug 4 '10 at 20:57.

Had an epiphany over the weekend about how to fix this problem and I finally found a good work around for my app.. I know it isnt optimal because I hard coded the number 100 into it but for my uses as of now I know I won't ever have that many list items.. I added these 2 bits of code to my alertsadapter class int startzero = 0; public static String promomatrix = new String6100; and promomatrix0startzero = al. Cityid; promomatrix1startzero = al. Promoterid; promomatrix2startzero = al.

Promocontent; promomatrix3startzero = al. Promotitle; promomatrix4startzero = al. Locationid; promomatrix5startzero = al.

Cover; startzero++; then went to my homepageactivity class and added this to the click listener Intent intent = new Intent( HomePageActivity. This,PromotionActivity. Class); intent.

PutExtra("listitemcity", AlertsAdapter. Promomatrix0pos); intent. PutExtra("listitempromoter", AlertsAdapter.

Promomatrix1pos); intent. PutExtra("listitemcontent", AlertsAdapter. Promomatrix2pos); intent.

PutExtra("listitemtitle", AlertsAdapter. Promomatrix3pos); intent. PutExtra("listitemlocation", AlertsAdapter.

Promomatrix4pos); intent. PutExtra("listitemcover", AlertsAdapter. Promomatrix5pos); finish(); startActivity(intent); and finally went to my promotionactivity (where I was trying to send the strings) and added this Bundle extras = getIntent().getExtras(); if (extras == null){ return; } String listitemcity = extras.

GetString("listitemcity"); String listitempromoter = extras. GetString("listitempromoter"); String listitemcontent = extras. GetString("listitemcontent"); String listitemtitle = extras.

GetString("listitemtitle"); String listitemlocation = extras. GetString("listitemlocation"); String listitemcover = extras. GetString("listitemcover"); worked like a charm.. I hope this helps someone :).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions