Set Single Choice Items problem

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Set Single Choice Items problem

Postby Helios » Sun May 24, 2009 2:16 am

Hi to all. If I have an array of strings, example: String [] array = {"moon", "sun", "earth"};
Is it possible to use setSingleChoiceItems() to create a single choice dialog that shows the strings in the array as options? How can this be done? Thanks in advance.

Regards.
Helios
Junior Developer
Junior Developer
 
Posts: 23
Joined: Sat Jan 17, 2009 7:11 am

Top

Postby divestoclimb » Tue Jun 02, 2009 2:29 am

You need to create an ArrayAdapter and bind it to the type of View you want to use to display the choices. The best options would be a single-choice ListView or a Spinner, depending on how much space you have to work with.

The Android API demos do this exact thing in the Spinner example.
divestoclimb
Developer
Developer
 
Posts: 33
Joined: Mon May 11, 2009 7:46 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 10 guests