I have a String array initialized globally Like:
String[] links={""};
in an onclick listener i m putting some values in it using a for loop
links = new String[Link.size()];
String[] news = new String[Catagory.size()];
for (int k = 0; k < Catagory.size(); k++) {
news[k] = Catagory.get(k).toString();
if (news[k].contentEquals("Android Apps")) {
links[k] = Link.get(k).toString();
Toast.makeText(getApplicationContext(), links[k],
Toast.LENGTH_LONG).show();
SHOW.add("Title:" + "\n" + Title.get(k) + "\n"
+ "Date:" + "\n"
+ PubDate.get(k).replace("+0000", "") + "\n"
+ "Content:" + "\n"
+ Content.get(k).replace("<br/>", "") + "\n");
Log.i("IF ELSE", Catagory.get(k));
}
}
and its happening correctly. But when I call this array in onitemclick listener method then it shows Blank again:
public void onItemClick(AdapterView<?> a, View v, int position, long id) {
Toast.makeText(getApplicationContext(), links[position], Toast.LENGTH_LONG).show();
}
How can i get the array values that i had those in the onclick listener?
Comments
Post a Comment