1

I'm a beginner with android.

What I want to do is, loading multiple image icons, like a folder with images needed to be opened. A user will select one and that image should be displayed in full size.

Here is what I've done till now...

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    addListenerOnButton();

}

public void addListenerOnButton() {

    image = (ImageView) findViewById(R.id.imageView1);

    button = (Button) findViewById(R.id.btnChangeImage);
    button.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {

            image.setImageResource(R.drawable.def);
        }

    });

}

I mean, here the image will be changed, if I add more images in setImageResource, but not like the way I want them to be. What should I do further? Please help...

bookishq
  • 193
  • 1
  • 3
  • 11
  • 1
    you may want to take a look at [gridview](http://developer.android.com/guide/topics/ui/layout/gridview.html) control. Also, for example take look here http://stackoverflow.com/questions/6855399/how-to-implement-image-gallery-in-gridview-in-android – Rohit Jan 27 '13 at 05:48
  • Thanks, but I tried that HelloImage program and still getiing errors.. Can you please help? – bookishq Jan 27 '13 at 06:19
  • What errors are you getting? – Rohit Jan 27 '13 at 06:21
  • Not errors, but in that program, they're only returning position, right? What if, I want to display the whole image, on which I've clicked. Sorry, I really don't know how these things work.. – bookishq Jan 27 '13 at 06:27
  • See the gridview.setOnItemClickListener on the answer for the SO question mentined above. – Rohit Jan 27 '13 at 06:46

0 Answers0