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. no virtual keyboard available

I have developed an app that uses setTextFilterEnabled(true).  It
works perfectly on my G1.  My partner has a new MyTouch phone that
does not have a real keyboard.  He cannot use this functionality at
all.  He tried holding down the menu key(and so have I) but the
keyboard does not appear.  Without a keyboard, this app is dead on
arrival.  I am trying the following code to no avail.

                setListAdapter(new ArrayAdapter<String>(this,
                        android.R.layout.simple_list_item_1, data ));
                getListView().setTextFilterEnabled(true);

                final InputMethodManager imm =
        (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
                            imm.showSoftInput( null, 0);

--~--~---------~--~----~------------~-------~--~----~

2. How can I know all attributes I can use in declare-styleable attr tag?

In ApiDemos, I can see how to define my custom elements to use in
layout resources. That is :

<declare-styleable name="LabelView">
        <attr name="text" format="string" />
        <attr name="textColor" format="color" />
        <attr name="textSize" format="dimension" />
</declare-styleable>

But that is just a simple demo. I can define like this:

<declare-styleable name="MyWidget">
<attr name="textX" format="integer" min="0"/>
</declare-styleable>

I use the "min" attribute, I want to know all the attibutes I can use
and how to use, where is the document?

Thanks.
--~--~---------~--~----~------------~-------~--~----~

3. I want more text in Preference summary

4. Service context can not serve Dialog?

5. Can an application get event that it is installed?

6. Design help on sliding panels

7. How to Access SharedPreferences created file?