There is nothing to do to show the selection. Note however that the selection appears only when you use the physical keys (that is your keyboard in the emulator). Touching (clicking with your mouse) the screen won't show the selection.
On Thu, Jun 19, 2008 at 3:27 AM, juma <[EMAIL PROTECTED]> wrote: > > Hi, > > > I displayed some list of items in the emulator. > > Item-1 > Item-2 > Item-3 > > I want to display some page,When i click the items. > I done in the m3 version.successfully. > But i cant do in the m5 version.Because there is no highlight > bar displayed in the items. > What is the code we have to follow to display the highlight bar > in the items. > > Here my code is > > > package com.IW.Architectureee; > > import java.util.ArrayList; > import java.util.HashMap; > import java.util.List; > import java.util.Map; > > import android.app.ListActivity; > import android.content.Intent; > import android.os.Bundle; > import android.os.Handler; > import android.util.Log; > import android.view.Menu; > import android.view.View; > > import android.widget.ListView; > import android.widget.SimpleAdapter; > public class MenuArchitecture extends ListActivity { > > private Handler handler = new Handler(); > private int contentViewId,page; > public static final int EXTERIOR = Menu.FIRST; > public static final int MENU=Menu.SECONDARY; > public int imageno; > public int selectionRowID; > > > > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle icicle) { > super.onCreate(icicle); > setContentView(R.layout.menu); > > String[] labels = new String[] { > "EXTERIOR1", "EXTERIOR2", "LIVING ROOM", "DINING ROOM1", > "DINING ROOM2","BED ROOM1","BED ROOM2","HOUSE PLAN","ADDRESS","SLIDE > SHOW" }; > > setListAdapter(new SimpleAdapter(this, > getData(labels),R.layout.menu_item, new String[]{"title"}, new int[] > {R.id.title})); > > } > > > > private List<Map<String, Object>> getData(String[] labels) > { > List<Map<String, Object>> list = new > ArrayList<Map<String,Object>>(); > > for (String label : labels) > { > list.add(getMap(label)); > } > return list; > } > > private Map<String, Object> getMap(String label) > { > Map<String, Object> map = new HashMap<String, Object>(); > map.put("title", label); > return map; > } > > protected void onListItemClick(ListView l, View v, int > position, > long id) { > //Log.i("","Selected"); > super.onListItemClick(l, v, position, id); > > // Get the item that was clicked > Object o = this.getListAdapter().getItem(position); > String keyword = o.toString(); > > > Intent myStarterIntent = null; > try { > > selectionRowID = (int)getSelectedItemPosition(); > //selectionRowID = (int)gets > > > //To display exterior page > if (selectionRowID==0) > > > { > > myStarterIntent = new Intent(this, > MenuArchitecture2.class ); > > //Send the Intent to the OS. > this.startActivity(myStarterIntent); > > > } > //To display exterior1 page > if (selectionRowID==1) > > > { > > myStarterIntent = new Intent(this, > exterior1Page.class ); > > //Send the Intent to the OS. > this.startActivity(myStarterIntent); > > > } > //To display exterior1 page > if (selectionRowID==2) > > > { > > myStarterIntent = new Intent(this, > LivingPage.class ); > > //Send the Intent to the OS. > this.startActivity(myStarterIntent); > > > } > > //To display dining1 page > if (selectionRowID==3) > > > { > > myStarterIntent = new Intent(this, > dining1Page.class ); > > //Send the Intent to the OS. > this.startActivity(myStarterIntent); > > > } > //To display dining2 page > if (selectionRowID==4) > > > { > > myStarterIntent = new Intent(this, > dining2Page.class ); > > //Send the Intent to the OS. > this.startActivity(myStarterIntent); > > > } > //To display bedroom1 page > if (selectionRowID==5) > > > { > > myStarterIntent = new Intent(this, > bedroom1Page.class ); > > //Send the Intent to the OS. > this.startActivity(myStarterIntent); > > > } > //To display bedroom2 page > if (selectionRowID==6) > > > { > > myStarterIntent = new Intent(this, > bedroom2Page.class ); > > //Send the Intent to the OS. > this.startActivity(myStarterIntent); > > > } > //To display plan page > if (selectionRowID==7) > > > { > > myStarterIntent = new Intent(this, planPage.class ); > > //Send the Intent to the OS. > this.startActivity(myStarterIntent); > > > } > //To display address page > if (selectionRowID==8) > > > { > > myStarterIntent = new Intent(this, > addressPage.class ); > > //Send the Intent to the OS. > this.startActivity(myStarterIntent); > > > } > > //To display address page > if (selectionRowID==9) > > > { > Log.i("","SlideShow"); > myStarterIntent = new Intent(this, > slideShowPage.class ); > > //Send the Intent to the OS. > this.startActivity(myStarterIntent); > > > } > > } > > catch (Exception e) > { > > } > // Start the activity > //startActivity(myStarterIntent); > } > > > > } > > > Thanks > judy > > > > -- Romain Guy www.curious-creature.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---