3

I have two screens, in second screen i have one back button that shows the first screen(using intent). if i click that back button from second screen i navigated to first screen no probs in that.. now i want to navigate back to second screen automatically without clicking any button. Please help me how can i do this. Thanks for ur valuable time .

selva
  • 446
  • 1
  • 7
  • 21

4 Answers4

1

I would give a try to a ViewFlipper activity, with two screens. This, of course, if you can encapsulate your actions into one activity (which i'm sure is manageable with AsyncTasks / Threads, Services and Handlers).

This way you can use gestures, (soft/hard)buttons, dropdowns, -whatever-, to navigate between your screens.

rekaszeru
  • 19,130
  • 7
  • 59
  • 73
  • its easy..you have knowledge about how to set Dynamic relative layout's child relativity?? – Tofeeq Ahmad May 02 '11 at 08:37
  • You have to use `RelativeLayout.LayoutParams` when adding the new view to the `RelativeLayout`. In that instance you can add rules to where to put the new view. You should take a look at [this question](http://stackoverflow.com/questions/2305395/laying-out-views-in-relativelayout-programmatically), it has a nice example as well. – rekaszeru May 02 '11 at 08:48
0

You can automatically go back to a previous activity on the Activity stack by calling the finish() method.

If you want to do this without any user interaction, use a Handler that automatically calls finish() on your activity after a predefined timeout (see this article for more information on Handlers).

Ithildin
  • 56
  • 2
0

try with Thread.sleep([ms]) and then call finish or call intent to the first

Toshe
  • 459
  • 1
  • 6
  • 20
0

The one solution is, when you press BACK button from second screen instead of call finish(); you should start first activity again, so the activity stack will be

FIRST
SECOND
FIRST

so after the delay of two second your activity will finish and eventually will come back to second screen, and state will be maintained also.

Adeel Pervaiz
  • 1,336
  • 10
  • 11