Hi Question about menu

by 鏅鸿秴 钖 » Fri, 23 Apr 2010 08:05:08 GMT


Sponsored Links
 i want to realize button pop-up optionmenu,

i write a button setOnClickListener, check this could pop-up menu ,

how to made it?

my code is:

case R.id.tools:
if(myMenu==null) {
                                        myMenu.add(0, 0, 0, 
"Add").setIcon(R.drawable.addfolderr);
                                        myMenu.add(0, 1, 0, 
"Delete").setIcon(R.drawable.delete);

                                }
                                onCreateOptionsMenu(myMenu);
                                break;
but method onCreateOptionsMenu(menu) not work;
type System.out.println("12334"); it could print ,but the menu not
work:(
anyone know how to make it work? or  had other way to pop-up menu

--



Hi Question about menu

by ~ TreKing » Fri, 23 Apr 2010 10:19:22 GMT


 




Try checking if (myMenu != null), since, you know, you probably want a valid
object to add stuff to.

-------------------------------------------------------------------------------------------------
TreKing - Chicago transit tracking app for Android-powered devices
 http://sites.google.com/site/rezmobileapps/treking 

--


Sponsored Links


Other Threads

1. Writing an app using android.speech.srec ... how to get to that code?

Does anyone know what Android plans as a replacement for the
functionality of android.speech.srec? Not transcription like that
provided via the RecognizerIntent, but something that would allow us
to build apps with voice interfaces that let the user navigate the app
hands-free?

-Mark









--

2. MediaPlayer error (1, -1)

I am a new Android developer using "Android Wireless Application
Development" as my book. I am running through the first example where
I am using URI to obtain an mp3 file to playback through the media
player. For some reason the audio file isn't playing and I am getting
a media player error of (1, -1). I am running my example through the
emulator. Any idea what is wrong?

--

3. Can not build LatinIME code

4. RelativeLayout doesn't work as expected in a ListView container.

5. Do manually created sqlite databases get exported when an apk is built?

6. Invalid View object passed to onListItemClick()?

7. How do I use getSharedPreferences on a non-visual class?