Hi,

Requirement : Is to show a warning dialog to the user when phone
powers up and that should be the first screen on the phone after power
up.

I have a stand alone app with a activity and that activity has a
Dialog  with "OK" button to show up on the phone power up. And this
app has the highest priority. I can see the activity getting started
on the power up.

The problem i am facing is :

When i press "OK" on the dialog the, dialog disappears but the
activity remains on the screen. I have finish() called in the onclick
of OK but still the activity remains on the screen.

Pls do let me know how to resolve this problem,

My code is as below :

public class Warning extends Activity implements OnClickListener{
         AlertDialog alert_new;
          boolean warningShown = false;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

       if(warningShown == false){
           showDialog(1);

         }

       @Override
    protected Dialog onCreateDialog(int id) {

        if(id == 1){
                   AlertDialog.Builder alert = new AlertDialog.Builder(this);
               alert.setTitle("Attention");
               alert.setMessage("HEllO.");

               alert.setPositiveButton("OK", new
DialogInterface.OnClickListener() {
                  public void onClick(DialogInterface dialog, int
whichButton) {

                     Warning.this.finish();

                      }
                      });
                alert_new = alert.create();
        }
                return alert_new;


    }

    }


Manifest file contains the below code to make it high priority :

<intent-filter android:priority="300">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.HOME" /
>
                <category
android:name="android.intent.category.DEFAULT" />
            </intent-filter>

        </activity>

Thanks,

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to