3

I need your help, cause I'm thinking about how to resolve this problem and don't know what's the best method:

What I have:

I have a standard ImageGallery. Below this, there is a Button.

What I want:

When I press this Button, there shall be opened a List of all the images, consisting of a small image on the left and a short description in one row, all the content should be brought by an array in an extra folder. By clicking one row, the chosen image should appear in the Gallery and the list should be closed.

What I am thinking:

is, that I have to create a custom Dialog (Alert Dialog?Binder?), started by the Button. This Dialog must be filled with a custom ListView.

What I don't know:

What components of the framework do I need for this? I have found some things with Google, but at least I'm not sure what's the most efficient way. I saw, that somebody had created an extra activity for the Dialog, using a DialogLayout. Someone else tried it with a builder, another one with an AlertDialog.

Furthermore, I'm confused about the combining of the ListView, ArrayAdapter, Dialog, ViewBinder, getView, Objects and so on.

Someone has an idea how to resolve this on the easiest way?

10ff
  • 813
  • 4
  • 16
  • 31
  • Try this, http://stackoverflow.com/questions/2169649/open-an-image-in-androids-built-in-gallery-app-programmatically – Noby Oct 31 '11 at 09:07
  • Sorry, I was searching for something else, but thanks! – 10ff Oct 31 '11 at 12:30

1 Answers1

1

You need to do something like this:

  1. Define an activity extending ListActivity.You can refer this tutorial how to use listactivity.
  2. Add this activity in your manifest file with theme attribute android:theme="@android:style/Theme.Dialog" in your activity tag which will make your activity look like a dialog.
  3. You can start this activity on your button click.
  4. If you want some result should be returned to your calling activity then use startActivityForResult().
Vineet Shukla
  • 23,865
  • 10
  • 55
  • 63
  • Thanks, that will be the easiest way. But I've come to another thing I'm in trouble with: How can I create my own List in which there shall be a various ImageView and 2 TextViews for each line? All the tutorials I've found don't have this combination. Will I have to write two Custom ArrayAdapters? Or isn't it possible to set multiple ArrayAdapters? http://mylifewithandroid.blogspot.com/2008/03/my-first-meeting-with-simpleadapter.html This one shows just the TextViews-ListView very well, but I will have to implement the images, too. So what? – 10ff Oct 31 '11 at 12:28
  • you need to write your own custom list adapter using BaseAdapter. Here is a sample custom listview as par your requirements:http://lovingandroid.blogspot.com/2011/08/custom-list-adapter.html – Vineet Shukla Nov 02 '11 at 04:42