• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How can i know current foreground activity(not from service)?

 
Greenhorn
Posts: 3
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there..

I am having alert generation application. I want to start or switch to other(Third) activity from current activity(foreground) using another activity's context(middle). From current activity(foreground) i m switching to other(middle) activity using intents and from this switched activity again i m switching to another(third) activity using intents. Due to such scenario, i am getting little but flash of middle activity in between current foreground activity and final most(third) activity.
How can i resolve this one?

For this purpose i want to know current foreground activity or is there any other solution?

I am not having any ideas about this one. Highly appreciate solutions.

Thanks in advance
 
Ranch Hand
Posts: 105
Android Mac Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Balaji,

There is a topActivity field defined on the RunningTaskInfo class. You can get a list of running tasks via the getRunningTasks(int) method in the ActivityManager. Traverse through that list to find the currently active task by checking the topActivity field.

Regards,

Johan
 
Balaji Khadake
Greenhorn
Posts: 3
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Johan Pelgrim wrote:Hi Balaji,

There is a topActivity field defined on the RunningTaskInfo class. You can get a list of running tasks via the getRunningTasks(int) method in the ActivityManager. Traverse through that list to find the currently active task by checking the topActivity field.

Regards,

Johan




Thanks a lot Johan...
Can i hide the middle activity view while switching from foreground activity view to third activity view because i m using intents?
Due to use of intents for switching activities i get flashing of middle activity's view which i don't want.
 
Johan Pelgrim
Ranch Hand
Posts: 105
Android Mac Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Balaji,

Maybe I don't really understand what you are trying to achieve. Basically you shouldn't interfere with which activity is placed before what other. You should let the ActivityManager take care of that for you. There is an AlarmManager in Android, which you can utilize to activate something at a certain point in time. Maybe that's what you need?

Cheers,

Johan.
 
Balaji Khadake
Greenhorn
Posts: 3
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Johan Pelgrim wrote:Hi Balaji,

Maybe I don't really understand what you are trying to achieve. Basically you shouldn't interfere with which activity is placed before what other. You should let the ActivityManager take care of that for you. There is an AlarmManager in Android, which you can utilize to activate something at a certain point in time. Maybe that's what you need?

Cheers,

Johan.



Thanks Johan
i got what i want...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic