Hi Filip, Thanks for your replies. But I want the functionality like how is it happening in "NDTV App' which i downloaded it from Android Market.
Thanks!! On Sat, Mar 26, 2011 at 1:12 AM, Filip Havlicek <[email protected]>wrote: > Hi Laxmi, > > if everything else works fine, just call finish() inside Activity 2 in step > 2) of your scenario. > > Best regards, > Filip Havlicek > > 2011/3/25 Laxmi Verma <[email protected]> > >> Hi, >> >> I am still facing this issue. I am not sure how to refresh my previous >> activity on back button. I had written the code of calling the intent >> itself of onResume() method but everytime i am press back button of next >> activity it goes to the previous activity's on resume method and reload that >> activity. And then when i click back button from there it calls that >> activity from which i loaded it. >> >> *Scenario is: >> >> 1) Activity 1 - > Activity 2 >> 2) From Activity 2 called back button >> 3) It goes onresume method of activity 1 and reloaded it. >> 4) When I click back button on activity 1 it goes to the activity 2. >> 5) Now, clicked back button on activity 2 >> 6) It reloaded activity 1 by going into on resume method of it. >> * >> This loop continues till infinity and it never goes back to the home >> screen. >> >> Any suggetions would be a great help as I need it on urgent basis !! >> >> Thanks!! >> >> >> >> On Wed, Mar 23, 2011 at 2:18 PM, Filip Havlicek <[email protected] >> > wrote: >> >>> Hi Laxmi, >>> >>> if you click the item detail's back button, it does not call the onCreate >>> method unless you specify so in the button's OnClickListener. >>> >>> If you press the phone's back button, the onResume of the list activity >>> is called, so if you want it to do the same thing as onCreate, just move the >>> code into some method and call it from both onResume and onCreate. >>> >>> It's the same principle as Notepad tutorial uses >>> http://developer.android.com/resources/tutorials/notepad/index.html(populateFields() >>> method). >>> >>> Best regards, >>> Filip Havlicek >>> >>> 2011/3/23 Laxmi Verma <[email protected]> >>> >>>> Hi Filip, >>>> >>>> It is exactly the same problem which I am facing. >>>> >>>> If I am only clicking back button it does not go to oncreate method and >>>> hence not refreshing the content of the view. >>>> By clicking phone back button its going to the previous list body item, >>>> but not refreshing it. I just want to refresh that thing. so, that if >>>> some >>>> image get updated I want to show the updated image in it. >>>> >>>> Can you please provide some sample code for it. >>>> >>>> Thanks & Regards >>>> >>>> >>>> >>>> On Tue, Mar 22, 2011 at 11:45 PM, Filip Havlicek < >>>> [email protected]> wrote: >>>> >>>>> Hi Laxmi, >>>>> >>>>> I'm not sure I fully understand. So you have some kind of list with >>>>> items and when you click the item, a new type of view is shown - let's say >>>>> item details. And in these details you have prev/next button to show >>>>> details >>>>> of neighboring items, is that correct? So if I click on item 4, i can then >>>>> press prev/next button to navigate to item 3/5 details, right? And you >>>>> want >>>>> to go back to the list view on phone's back button press? >>>>> >>>>> If all of this is correct, then it is pretty much simple. This is >>>>> pretty much doable in both ways (call activities and change views). If you >>>>> have activities, let's try to fix them rather than going the views way. >>>>> All >>>>> of the items have IDs. List activity takes pressed item ID and sends it as >>>>> an extra to the details activity. ID is stored in activity's member field >>>>> and then item details are displayed with prev/next buttons (based on the >>>>> stored ID). Now when you click on one of the buttons, you query your >>>>> database (or whatever source your data are in) for a list of IDs, you find >>>>> your stored ID and then find next/previous ID. You store this found ID in >>>>> activity's member field overwriting previous ID and just call some refresh >>>>> view method (pretty much like in Google's Notepad tutorial). Now when you >>>>> press phone's back button, you will be by design taken back into the list >>>>> view (no back button handling is necessary). >>>>> >>>>> Best regards, >>>>> Filip Havlicek >>>>> >>>>> 2011/3/22 Laxmi Verma <[email protected]> >>>>> >>>>>> Hi Filip, >>>>>> >>>>>> Thanks for giving the reply. can you please clarify "*why not just >>>>>> change the view(s) instead of trying to start/stop activities?*". I >>>>>> am having a list item activity and calling the list body item activity >>>>>> from >>>>>> there. Inside List Body Item activity I am having next and previous >>>>>> button. So, after navigating to 2 to 3 list body items and pressing back >>>>>> button, if I am refreshing the same activity again then I am facing this >>>>>> issue that it calls the list item body activity on onResume method every >>>>>> time I press back button and never goes back to the List Item Activity. >>>>>> >>>>>> Hope you understand my problem. >>>>>> >>>>>> Thanks!! >>>>>> >>>>>> >>>>>> On Tue, Mar 22, 2011 at 10:03 PM, Filip Havlicek < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> Hi Laxmi, >>>>>>> >>>>>>> if you are calling the same activity over and over again, why not >>>>>>> just change the view(s) instead of trying to start/stop activities? And >>>>>>> then >>>>>>> you just "register" the phone's back button press to perform the same >>>>>>> action >>>>>>> as your back button on the screen (will just call the same method) and >>>>>>> it >>>>>>> will work just fine. >>>>>>> >>>>>>> Best regards, >>>>>>> Filip Havlicek >>>>>>> >>>>>>> 2011/3/22 Laxmi Verma <[email protected]> >>>>>>> >>>>>>>> Hi All, >>>>>>>> >>>>>>>> Same problem I am facing for my application. I want to refresh my >>>>>>>> previous activity on back button. >>>>>>>> I am having an activity containing next and previous button. On >>>>>>>> clicking next and previous button I am calling the same activity >>>>>>>> itself but >>>>>>>> with different content. >>>>>>>> Now, If I am calling this activity by startActivity() in onResume() >>>>>>>> method, the problem what coming is that if I click on back button >>>>>>>> (Phone) it >>>>>>>> goes to the onResume method of this activity and calling this activity >>>>>>>> again. So, everytime I am pressing back button, it is calling the same >>>>>>>> activity itself and never goes back to the home screen. >>>>>>>> The same problem is occurring with on key back method. >>>>>>>> >>>>>>>> I am not sure how to do this. I tried various Intent flags also but >>>>>>>> of no use for e.g. FLAG_ACTIVITY_CLEAR_TOP, FLAG_ACTIVITY_SINGLE_TOP >>>>>>>> and >>>>>>>> FLAG_ACTIVITY_NO_HISTORY >>>>>>>> >>>>>>>> Any help in this regard would be highly appreciated as I need this >>>>>>>> on urgent basis. >>>>>>>> >>>>>>>> Thanks!! >>>>>>>> >>>>>>>> On Tue, Mar 22, 2011 at 5:28 PM, Filip Havlicek < >>>>>>>> [email protected]> wrote: >>>>>>>> >>>>>>>>> Hi Ranveer, >>>>>>>>> >>>>>>>>> maybe refreshing the contents in the history Activity's onResume() >>>>>>>>> method would be sufficient for your needs. >>>>>>>>> >>>>>>>>> Best regards, >>>>>>>>> Filip Havlicek >>>>>>>>> >>>>>>>>> 2011/3/22 harsh chandel <[email protected]> >>>>>>>>> >>>>>>>>>> @Override >>>>>>>>>> public boolean onKeyDown(int keyCode, KeyEvent event) { >>>>>>>>>> if (keyCode == KeyEvent.KEYCODE_BACK) { >>>>>>>>>> //Intent intent = new Intent(this,name of the class >>>>>>>>>> where you >>>>>>>>>> want to go to); >>>>>>>>>> >>>>>>>>>> startActivity(intent); >>>>>>>>>> >>>>>>>>>> return true; >>>>>>>>>> } >>>>>>>>>> return super.onKeyDown(keyCode, event); >>>>>>>>>> } >>>>>>>>>> >>>>>>>>>> this code captures the event on back button click >>>>>>>>>> >>>>>>>>>> On Mar 22, 8:49 am, Ranveer <[email protected]> wrote: >>>>>>>>>> > Dear all, >>>>>>>>>> > >>>>>>>>>> > I want to reload the previous activity (history) on back button >>>>>>>>>> click. >>>>>>>>>> > Right now When I am pressing back (Phone) it going to previous >>>>>>>>>> activity >>>>>>>>>> > but showing from history. >>>>>>>>>> > So every time I click back I want to reload the history page. >>>>>>>>>> > >>>>>>>>>> > regards >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> 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 >>>>>>>>>> >>>>>>>>> >>>>>>>>> -- >>>>>>>>> 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 >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> > -- 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

