lundi 18 mai 2015

checking whether the intent is empty before consuming the result

I am getting an intent from the onPostExecute emthod in my onNewIntent method. Sometime has this intent a vlaue and only then I want to diplay my Dialog window but at the momenat the AlertDialog is being diplay in the method even when the intent is empty?! How can I avoid that since I am already checking it

    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);

        Bundle extras = getIntent().getExtras();
        if (extras != null && extras.containsKey("stop_route")) {

            ArrayList<Integer> routeList = extras
                    .getIntegerArrayList("stop_route");

           AlertDialog.Builder builder = new AlertDialog.Builder(this);
           .
           .
           .

    }
}

Aucun commentaire:

Enregistrer un commentaire