Using Activity.openOptionsMenu()

by Mark Wyszomierski » Mon, 03 Nov 2008 14:29:19 GMT

Sponsored Links

Just wondering how one is supposed to use:


I'm calling it in my Activity, but it has no effect. I was expecting:

    onPrepareOptionsMenu(Menu menu) ;

to be called afterwards, but no luck.


Other Threads

1. Disabling specific wireless radios in the airplane mode

I have written code in my application to programmatically enable/
disable the airplane mode. This part of the application is working as
intended. However, I also wish to disable only specific radios when
the airplane mode is switched on. I found that there is the following
string constant in android.provider.Settings.system:

public static final String AIRPLANE_MODE_RADIOS
A comma separated list of radios that need to be disabled when
airplane mode is on. This overrides WIFI_ON and BLUETOOTH_ON, if Wi-Fi
and bluetooth are included in the comma separated list.

Constant Value: "airplane_mode_radios"

So, I tried to change this system setting in my code to be able to
disable only the WiFi radio in the airplane mode in the following way:

(),Settings.System.AIRPLANE_MODE_RADIOS, Settings.System.RADIO_WIFI);
(),Settings.System.AIRPLANE_MODE_ON, 1);

The problem is that doing this does not change the airplane mode as
intended. It still seems to switch off all the wireless interfaces.
I am using eclipse with the ADT plugin and using an Android 1.5 AVD
Can someone guide me on whether I am doing something wrong or if this
is not supported on the emulator?

Akhilesh Gupta


2. using the getLine1Number() method

Ok, I'm still new to using java and j2me all together, although I
understand enough to make basic programs and understand what I think
about returning methods. I'm having trouble with the code below, for
now all i want my code to do is pull up the MSISDN "telephone number"
that a mobile device has. Everytime i run the emulator I get an error
that the app has stopped unexpectedly and to try again. I've modified
the helloworld demo a little bit and just trying to get the tn to show
up. please tell me what i've done wrong and can someone also send me
an article about using the android api's please.

package com.general.AntiClep;

import android.os.Bundle;
import android.widget.TextView;
import android.telephony.TelephonyManager;

import android.content.Context;
public class AntiClep extends Activity {
   /** Called when the activity is first created. */
   public void onCreate(Bundle savedInstanceState) {

        String str = null;
       TextView tv = new TextView(this);

   public String sum(){
           TelephonyManager tm = (TelephonyManager)getSystemService

                String result = tm.getLine1Number();

                return result;



3. How Do I Install Market Apps on the Emulator, and other questions about Intents

4. fastboot download too many links

5. android developers challenge II

6. JAVA Coding standards for Android Platform

7. Can't install the latest security update (CRC1)