How to get the current acivity name?

Put your problem here if it does not fit any of the other categories.

How to get the current acivity name?

Postby amuyeed » Tue Nov 24, 2009 7:00 am

Hi there,

I have a service. There are 6 activities(screens) in the application. When I receive some data from the service, I need to check which activity is highlighted(displayed). Based on that I need to do perform some actions.

Is there any way through which I can come to know which is in the foreground?

Regards,
Abdul Muyeed M
amuyeed
Freshman
Freshman
 
Posts: 8
Joined: Sat Mar 01, 2008 4:15 pm

Top

Postby virtual » Tue Nov 24, 2009 9:31 am

Well may be this is not the right way to do this but it can be done by storing may be some flag or the classname itself every time you start any activity. Any time when the displayed activity is starting any other activity first update the stored data for the new activity and set the new activity. In your case for six activity you will need six flag.

When you receive something from the service just check the stored flag and do what you need to do.

It is just one way to do. I don't know if android provides something to know the current activity's info or not.
Regards,
Virtual
virtual
Developer
Developer
 
Posts: 26
Joined: Tue Mar 24, 2009 11:20 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Google Feedfetcher and 11 guests