By default the function of back is to go to the previous activity. So
dont override it.
Try using
Calling Activity:
onActivityForResult(intent, Constants.SUBACTIVITY_RESULTCODE_MOVEBACK)
@Override
protected void onActivityResult(int requestCode, int resultCode,
String data, Bundle extras) {
switch(resultCode){
case Constants.SUBACTIVITY_RESULTCODE_MOVEBACK:
OnBack();
break;
}
/* Finally call the super()-method. */
super.onActivityResult(requestCode, resultCode, data,
extras);
}
Called Activity, On pressing back button:
this.setResult(Constants.SUBACTIVITY_RESULTCODE_MOVEBACK);
this.finish();
On Feb 16, 7:25 am, Komal <[email protected]> wrote:
> Hi Immy
> Thnx for replying.
> I want to use the back button for going back, i dont want to prevent
> it.
>
> >>Close with finish() for that activity when you are done.
>
> and if i am calling finish(),,then it is not showing the employee
> detail, it just go to the next activity(employee activity page) call
> oncreate and comes back to previous activity
>
> > > Use intents this way,
> > > Intent i = new Intent(this, CardView.class);
> > > startActivity(i);
> > StartActivityforResult
>
> I tried both the way,,when i am using startActivityForResult(),,it
> cames back to previous activity,and calling my method(for displaying
> list),,in this method i m calling setListAdapter(new IconicAdapter
> (MoreData.this));
> its not calling getView() method.i have override the getView method.
>
> On Feb 13, 4:50 pm, Immy <[email protected]> wrote:
>
> > or use StartActivityforResult... Do a search for
> > StartActivityforResult
>
> > On Feb 13, 10:47 am, Immy <[email protected]> wrote:
>
> > > Use intents this way,
> > > Intent i = new Intent(this, CardView.class);
> > > startActivity(i);
>
> > > Close with finish() for that activity when you are done.
>
> > > This's how you override the back button to prevent it from going back.
>
> > > @Override
> > > public boolean onKeyDown(int keyCode, KeyEvent event) {
> > > // TODO Auto-generated method stub
>
> > > switch(KeyEvent.KEYCODE_BACK)
> > > {
> > > case KeyEvent.KEYCODE_BACK:
> > > return true;
> > > }
> > > return super.onKeyDown(keyCode, event);
> > > }
>
> > > Regards,
> > > Immanuel
>
> > > On Feb 12, 9:58 am, Naina K <[email protected]> wrote:
>
> > > > Hi,
>
> > > > Thanks for replying. Yes, i have to use two separate activities to
> > > > display screens. No I am not using the finish() in the first activitiy
> > > > :-( To be frank as I am still learning this android development, I am
> > > > not getting how to use two different activities to display screens. I
> > > > just know that I need to use two activities in my application and
> > > > tried also but somehow its not working :-( I guess if I am having two
> > > > activities then i need to use intents for the same. But I guess
> > > > something is going wrong in using intents.
>
> > > > Could you please guide me for this with some sample application? I
> > > > would be greatfull :-)
>
> > > > Thanks,
>
> > > > On 2/12/09, Sundog <[email protected]> wrote:
>
> > > > > By "screens", do you mean separate activities displaying screens?
> > > > > That's the first thing. Only activities will work correctly with the
> > > > > back button.
>
> > > > > If you are properly doing it with two separate activities, how are you
> > > > > calling the second one? Are you using a finish() in the first
> > > > > activity? If so, remove it.
>
> > > > > On Feb 11, 4:30 pm, Komal <[email protected]> wrote:
> > > > >> Hello NewDev,
> > > > >> I am facing the same problem.do u have solution of it???if u have
> > > > >> then
> > > > >> please post it.
> > > > >> Thanx.
>
> > > > >> On Feb 5, 9:47 pm, NewDev <[email protected]> wrote:
>
> > > > >> > Hi,
>
> > > > >> > I have anapplicationwith main view having a search button. On
> > > > >> > clicking the search button, search results are displayed in a text
> > > > >> > view. When I hit thebackbutton at this view, instead of navigating
> > > > >> > to the previous screen,applicationitself gets closed. Could
> > > > >> > anybody
> > > > >> > please let me know how togobackto previous screen.
>
> > > > >> > Thanks in andvance,
>
> > > > >> > Naina- Hide quoted text -
>
> > > > >> - Show quoted text -
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---