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, 
                                        myMenu.add(0, 1, 0, 

but method onCreateOptionsMenu(menu) not work;
type System.out.println("12334"); it could print ,but the menu not
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


Sponsored Links

Other Threads

1. PSM timeout


I hope that this is the right place to ask. What is the Power Saving
Mode (PSM) timeout in Android 1.5 on G1 phone? I could not find it in
manuals nor on the Internet.

Vilen Looga


2. Share Code


I've been told posting general questions is not a good idea, but I've
had some luck so I'll try again.  SInce this is a general question,
general answers are fine.

I'm working on an idea for a game and was wondering if it's possible
in Android.  It's basically an ad-hoc game so that 2 (or more) people
with android devices could play even if only 1 person has the app.
This game would involve sharing both data and code.  I think the data
sharing is possible.  What I think may be difficult is the sharing of

I've read some postings asking why one would want to share code, so
I'll answer that before you ask. The main reason is that the each
player of this game actually would write code (albeit often simple
code) and transmit it to the device hosting the game.  I could develop
my own language and transmit the instructions that way as data, but it
seems better to transmit the Java bytecode that would run on the phone
since I would include library functions they could call to perform
common actions.  For example a user might write this upon entering a
virtual room and spotting an enemy:

while (enemy.isalive()) {

if (health()<0.2) {

Also, having lived in areas where there is poor phone service I know
that being able to transmit directly to the person sitting next to you
in the car or while camping in nowhereland would be a good feature
regardless.   So even if I decide to transmit the user written code as
data, getting the original app from the web might not be reasonable in
some cases.  If transmitting code isn't reasonable, I still think the
app will work, it would just cause me to write it differently.


Is it reasonable/possible to directly share user written code?
Is it reasonable/possible to directly transmit an app directly from
one device to another?
What options exist for transmitting data and/or code?
If transmitting Java bytecode isn't reasonable, how does one go about
directly transmitting data to another phone?

In this game, one device would host the code written by all players
while the results of running the code would be updated on all devices
(if that's helpful).  So really only one person need have the total
app that's purchased.  Everyone else could have a free version that
didn't host the program's execution but allowed for writing
instructions, transmitting to the host and reading back the results as
it happens.

I would only expect you to point me in a reasonable direction and/or
post a link to the info that will answer these questions, even if only
partially.  So while I appreciate details, don't go nuts unless you
like that sort of thing.

Thanks in advance.


3. How to autorun program when Android start running?

4. Help me in Creating a AVD

5. anybody knows about Linkify

6. accuracy of Mock location

7. display thumbnail images from sdcard