Skip to main content

String Array doesn"t show the expected value



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

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?