Add dynamically images to a GridView in Android?

I don't think using Intent is the right thing for you here. As I gather it, you parse an xml to display images and you want to be able to add more images when users click on a button. So here is what you need to do.

I don't think using Intent is the right thing for you here. As I gather it, you parse an xml to display images and you want to be able to add more images when users click on a button. So here is what you need to do : in the onClick method of your button, you should start an AsyncTask or a background Thread, in which you make an http request on your url.

This will get you the xml of the next images, you parse it and prepare the images in your background Thread. Then back in your main Thread (in onClick method for instance), you grab these images, add them to the adapter of your GridView and call notifyDataSetChanged() to update your GirdView. And that should do the trick.

I followed your concept but now I call AsyncTask in button click url was changed and call Asynctask and pass url when I click button but did not reflect output in gridview,gridview display first 16 images was display in gridview what can I do How solve this problem – sivaraj Aug 21 '10 at 11:29 Please try to use punctuation in yours sentences, it's really hard to understand you. And well, with just your comment, I can't help you, you need to detail more. Add some code to your post, you might be doing something wrong in your AsyncTask.

– Sephy Aug 21 '10 at 11:34 public void onClick(View arg0) { pageno++; lay2_gv. SetVisibility(GridView. GONE); url="theblacksheeponline.Com/partypics.

Php? Page="+pageno; new Task_xmlparse(). Execute(url); lay2_gv.

SetVisibility(GridView. VISIBLE); } This code I used for click method,but I did not get more image in gridgiew.. – sivaraj Aug 21 '10 at 13:15 please edit your first post and put the full code from the onclick method AND the AsyncTask – Sephy Aug 21 '10 at 14:32.

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