android - How to get an activity via a view owned by this activity? -


i wrote standalone custom onclicklistener class (not member class) navigation bar. see codes below.

class myclickhandler implements onclicklistener {  @override public void onclick(view view) {     intent intent;     context ctx = view.getcontext();     int id = view.getid();     switch(id){      case r.id.app_home_id:         intent = new intent(ctx, formenginemainapp.class);         ctx.startactivity(intent);         break;     case r.id.app_tasklist_id:         intent = new intent(ctx, worklist.class);         ctx.startactivity(intent);         break;     //more cases...      }  }  } 

each button leads different activity. tend finish current activity after calling startactivity(intent);, need current activity instance call finish(). have no idea how current activity instance. thing may parameter view, checked out reference of view in android developers , failed find solution. suggestions?

when call finish(), entry of activity stack removed believe can never reference old activity anyway!

in case best part call using startactivitywithresult(..., ...) , depending on requestcode call finish before getting reference of old activity.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -