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. java.lang.OutOfMemoryError after orientation changed

I have a MapView App that I wrote a while back in 1.1. It worked after
I migrated it to 1.5. It is throwing the same exception you are seeing
in 1.6. The App stopped working after the 1.6 system update. I got a
chance today to upgrade my eclipse plugin to 0.9.5 and get the 1.6 sdk
and deploy the App again and saw the same error on logcat. I have
another MapView App that was also written a while back. It works
without any issue on 1.6. The main difference between the 2 Apps are
the views in the ViewGroup. In the App that works fine, there is only
1 view (MapView) on the ViewGroup. In the App that now throws the
OutOfmemory Exception, there are several Layouts with several views on
them (including a Mapview) that are assembled together to form the
ViewGroup.


10-30 14:59:50.841: INFO/dalvikvm-heap(23490): Forcing collection of
SoftReferences for 134217760-byte allocation
10-30 14:59:50.911: DEBUG/NetworkLocationProvider(75):
updateWifIScanResults(): 9 APs
10-30 14:59:50.991: DEBUG/dalvikvm(23490): GC freed 3582 objects /
263656 bytes in 146ms
10-30 14:59:50.991: ERROR/dalvikvm-heap(23490): Out of memory on a
134217760-byte allocation.
10-30 14:59:50.991: INFO/dalvikvm(23490): "main" prio=5 tid=3 RUNNABLE
10-30 14:59:50.991: INFO/dalvikvm(23490):   | group="main" sCount=0
dsCount=0 s=N obj=0x4001db08 self=0xbc48
10-30 14:59:50.991: INFO/dalvikvm(23490):   | sysTid=23490 nice=0
sched=0/0 handle=-1343996920
10-30 14:59:50.991: INFO/dalvikvm(23490):   at
com.google.googlenav.map.Map.resize((null):~-1)
10-30 14:59:50.991: INFO/dalvikvm(23490):   at
com.google.android.maps.MapView.onMeasure(MapView.java:536)
10-30 14:59:51.021: INFO/dalvikvm(23490):   at
android.view.View.measure(View.java:7703)
10-30 14:59:51.051: INFO/dalvikvm(23490):   at
android.widget.RelativeLayout.measureChildHorizontal
(RelativeLayout.java:569)
10-30 14:59:51.051: INFO/dalvikvm(23490):   at
android.widget.RelativeLayout.onMeasure(RelativeLayout.java:361)
10-30 14:59:51.051: INFO/dalvikvm(23490):   at
android.view.View.measure(View.java:7703)
10-30 14:59:51.051: INFO/dalvikvm(23490):   at
android.widget.RelativeLayout.measureChildHorizontal
(RelativeLayout.java:569)
10-30 14:59:51.051: INFO/dalvikvm(23490):   at
android.widget.RelativeLayout.onMeasure(RelativeLayout.java:361)
10-30 14:59:51.051: INFO/dalvikvm(23490):   at
android.view.View.measure(View.java:7703)





-- 

2. Broken Emulator after new update?

I've tried the following using an emulator with the 2.0 and 1.6 target
and still same results!

I'm currently trying to change the Telephony status via eclipse to
test how my application behaves on bad network speeds and dropped
connections.  But after the last updates to the SDK, now this settings
are not working!  I set Data and or Voice to denied and my application
is still downloading content...  Why is this?  I tried setting the
connection to a lower connection type and my app is still downloading
very fast no change!

I tried making a call to the emulator and that works...

I'm getting very frustrated! Could someone help me out?

Thanks!
-Moto

-- 

3. Does DexClassLoader works correctly?

4. TimePicker Hour Dissapears on Rotate

5. Would you at least give us names ?

6. Racun dulu lahh.. hahahaha xD

7. how to type in a webview