how to work with on onResume() in Android? -


i have 2 activities .first time run application have open popup in activity 1 when first start application. after want go activity 2 , make changes there. again come activity 2 , don't want open popup. problem whenever comeback 1st activity popup open.how solve issues?

here code.

db = dbhelper.getreadabledatabase();         string query = "select * inspector activestatus= '1' , followflag ='1'";         cursor cursor = db.rawquery(query, null);         if (cursor.movetofirst())         {                         {                 string strinspectorename = cursor.getstring(cursor.getcolumnindex("inspector_name"));                 string strinspectorid = cursor.getstring(cursor.getcolumnindex("inspector_id"));                  if(!strinspectorid.equals(str_loginuserid))                 {                     inspector_arraylist.add(strinspectorename);                     log.e("post ", " total followup users !!!" + strinspectorename);                 }              } while (cursor.movetonext());         }         cursor.close();         db.close();         int countfollowup = inspector_arraylist.size();         log.e("post ", " total countfollowup users !!!" + countfollowup);          if( countfollowup == 0)         {             final dialog dialog = new dialog(customactionactivity.this);             dialog.getwindow().setbackgrounddrawable(new colordrawable(0));             dialog.setcontentview(r.layout.custom_dialog_layout);              button followstart = (button) dialog.findviewbyid(r.id.button_followstart);             followstart.setonclicklistener(new view.onclicklistener() {                 @override                 public void onclick(view v) {                     intent = new intent(customactionactivity.this, filter_screen.class);                     startactivity(i);                  }             });              button dismissbutton = (button) dialog.findviewbyid(r.id.button_dissmiss);             dismissbutton.setonclicklistener(new view.onclicklistener() {                 @override                 public void onclick(view v) {                     dialog.dismiss();                 }             });             dialog.show();         } 

here onresume() in activity 1st

@override     protected void onresume()     {         super.onresume();          log.e(" activity ", " resume !!! ");         log.e("from ", " filter 222");         sharedpreferences sharedpreferences = preferencemanager.getdefaultsharedpreferences(getapplicationcontext());         booleanvalue_one = sharedpreferences.getboolean("listview_event_one", false);         booleanvalue_two = sharedpreferences.getboolean("listview_event_two", false);         log.e("", "booleanvalue_one=" + booleanvalue_one + " booleanvalue_two=" + booleanvalue_two);           if (booleanvalue_one == true || booleanvalue_two == true)         {             getallactivitydetails task = new getallactivitydetails();             task.executeonexecutor(asynctask.thread_pool_executor);             log.e(" booleanvalue_one "," = " + booleanvalue_one +" after completing async task !!!!");             updateddownloadstatus();         }          if (booleanvalue_one == false && booleanvalue_two == false)         {             populatelist();         }      } 

here 2nd activity onbackpressed() -> go 1st activity

@override public void onbackpressed() {         super.onbackpressed();         intent = new intent(filter_screen.this, customactionactivity.class);         a.setflags(intent.flag_activity_clear_top);         finish();         startactivity(a);         overridependingtransition(r.anim.slide_in_bottom, r.anim.slide_out_bottom); } 

make boolean key boolean key=true; , use boolean key display popup in onresume() , in oncreate() make boolean false

onresume() call when activity start , when come call again


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -