Android :: Communicate With A Location Manager Started From Another Activity
Aug 20, 2010
In my app I want to obtain a gps lock and record the coords. But I do not want to lock the device into looking for the gps. The user is to be free to traverse through the app and the different activities within.
So If I call a locationListener in activity A, can I reference it in activities B C and D?
if is was still in activity A I could say something like
A.this.mlocListener.removeMyUpdates();
When I am in activity B how can I reference the LocationListener I set up in Activity A
View 1 Replies
Oct 26, 2010
I'm developing a mapping app using Eclipse 3.5.I'm setting the minimum update period with the LocationManager's requestLocationUpdates method, via a configuration activity. When I set the property I see in Logcat that the system process sets the value OK.When I actually send a new location from the DDMS emulator control and the location changes on the map view, I see that the system process then sets the minimum time to zero.Below is a capture of the system's log messages. You can see that I'm setting the period to 32 seconds, then 16, then, after I've sent a simulated location change the system sets it to zero.The map responds to location changes to location changes instantly even if they are sent only a couple of seconds apart.
View 1 Replies
View Related
Sep 17, 2010
In my application I have to fetch the current location. First it correctly fetches the location. But we are moving from the current location to some other location. It shows the previous address. It is not updating the location. My code is: locManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); locListener = new MyLocationListener();locManager.requestLocationUpdates(LocationManager .GPS_PROVIDER ,0,0,locListener); location = locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);if(location != null){latitude = location.getLatitude();longitude = location.getLongitude();} Please find the mistake and when i launch first time it is not working on second time itself it is working so check this thing also.
View 1 Replies
View Related
Nov 2, 2010
I have a TabActivity, and each Tab corresponds to its own Activity. In one of them, in the onCreate method, I use startActivityForResult to show a dialog (specifically, Bump's BumpAPI activity).
code:...............
The problem is that when the screen orientation changes, it tries to create the tab's activity again which makes another BumpAPI dialog, resulting in multiple stacked on top of each other. Do I have a hook into the started activity to cancel the previous one when the orientation changes?
A workaround seems to be to add a button that when clicked, starts the second activity, but that adds an unnecessary step.
Also, I can't fix the screen orientation for the entire tabActivity because some of them require typing and users may want to use their physical keyboards.
View 1 Replies
View Related
May 1, 2010
I have following problem with my application: From my main activity ("activity 1"), there is a menu from which user can launch an action. This action will result in an Intent being received by a BroadcastReceiver, defined in my application. Finally, this BroadcastReceiver will start an activity ("activity 2") to deal with this intent.
The problem is that I have a "quit application" entry in my menu, and I can only finish() currently active activity. ie I am not able to finish "activity 1" from the menu of "activity 2". And I can't use startActivityForResult() as "activity 2" can't be started from "activity 1". Any suggestion would be much appreciated Thank you very much guys, regards.
View 4 Replies
View Related
Feb 17, 2010
Suppose I have an Activity that's a list. It calls a Service when this Activity starts.The Service will do background stuff download, parse, and fill the list.My question is this: How can the Service communicate with the Activity?How can I call a method in the Activity, from the Service? (I'm new to OOP)
View 2 Replies
View Related
Jan 30, 2010
In my current project I have a full screen TabActivity. Each tab content is handled by two instances of same ListActivity. Now, I put an extra int in intent to know which data should be displayed.So in onCreate method of my ListActivity, I check the int in extra and I build my query to obtain a SQLLiteCursor.I would like to dynamycally give to this two instances of ListActivity the list of item that should be displayed.I do not know what is the best way to do this. Any idea ?
View 1 Replies
View Related
Jun 25, 2010
I currently have a Service and an Activity in my application.I currently bind the Service to the activity without using AIDL as the Service and the Activity are in the same application.This allows me to call the methods from the Service within my Activity when I require them, however it doesn't let me call the methods of the Activity from within my Service when I want to.Can anyone comment on what would be the best way to achieve this?I could use Intents but is there an alternative option?I want to have tight communication between the Service and the Activity, I want to be able to call an Activity method from my Service when an event happens.
I now have it working the way I want, however I have come across a problem.My service gets status updates and my Activity is then supposed to react to the update sent on from the Service.The problem is that when I start my activity I get the Dialling Status and then Connected status before the onBind is called and I get the instance of iCallDialogActivity.
I need to be able to use my iCallDialogActivity when I get the Dialling and Connected Status notifications.But this gives me a NullPointer Exception due to it not being created in time when my Activity starts, binding is the first thing I do in my Activities onCreate().Is there a way to make it bind straight away?
View 1 Replies
View Related
Aug 2, 2010
In the Activity I write Intent i=new Intent("IntentServiceTest"); Bundle bundle = new Bundle(); bundle.putString("abc", "def"); i.putExtra("wer", bundle); IntentTest.this.startService(i); Start Service into Service OnCreate method,but I don't know how to do get this Intent in this method.
View 11 Replies
View Related
Feb 16, 2010
I have a service that listens to a socket. When receiving certain input it is to create an activity. When receiving other input, it is to kill this activity. I have struggled for a while to make the service communicate with the activity through AIDL (http://developer.android.com/guide/developing/tools/aidl.html), but this seems to not be effective. I think AIDL is only effective when the process that is to be talked to is a service, not when it is an activity? I would love some directions or suggestions on how to solve my problem.
View 1 Replies
View Related
Apr 2, 2010
Is there any way to specify the time intervals that the Location Manager broadcasts the current location?
I am using a method called startListening:
CODE:.....................
View 5 Replies
View Related
Mar 31, 2010
I just want to get numbers of times to be used for each Activity.
So the very straightforward method I thought is increasing the count for an Activity when it was started. But how can I get the information?
View 3 Replies
View Related
Jun 18, 2009
Is there a way to do this?
Can you access the activity stack in a way to grab what activity came before the one now in view?
I have a situation where an activity needs to know where it was started from, so it knows what data to display in that current activity.
View 7 Replies
View Related
Oct 19, 2010
How can I know what Activity has started the current Activity? Is there any specific method like, i.e. getIntent().getCallerActivity() or the only way is saving some information within the Intent using putExtra()?
View 1 Replies
View Related
Aug 2, 2010
Whenever the memory needs to be reclaimed, the process is being killed by Activity Manager Service in killPidsForProcess. I have a back button in my activity window on right corner of the title bar.
I want to kill the activity completely on clicking the close button. Can I reuse the same function and will it have any major effect? Please help me out in this.
View 3 Replies
View Related
Aug 25, 2010
I have a central activity that can be launched from two separate classes. I was hoping that in this central activity I could have an IF statement like
if(this.getIntent() == MainMenu.class)
{
// Do something here
}
But obviously that isn't legal so how could I structure an expression to check from what class an intent was started.
View 2 Replies
View Related
Jun 25, 2010
I have small simple Service and big MainActivity with UI. Service is called periodically from AlarmManager. My Service need to know if MainActivity is on the screen and inform MainActivity about state changing.
View 3 Replies
View Related
Jul 21, 2010
Suppose my application P started Activity A, and A started Activity B, then the activity stack contained A and B, with B at the top.
After that, I opened other apps by pressing Home button. Suppose after a while, the process of application P is killed by the OS. Then, I press Home button to select application P. At this time, which activity will be brought to the front, Activity A or Activity B?
View 1 Replies
View Related
Jun 17, 2010
I've a service which listens to user request for ending one activity and starting another activity. For Ex: Say there are activities1,2 ,& 3. Now if there is already activity1 started by someother activity then based on the user request i need to stop activity1 and start activity2 or activity3. If the acitivity1 is started by my service then i can do finishactivity(requestcode) and shall receive a call to onActivityResult() then i can start next activity 2 or 3. But can i stop the activity1 which is started by some other activity from a service?
View 2 Replies
View Related
Mar 19, 2010
I've successfully implemented a BootReceiver, AlarmManager, and Service per the code here: http://github.com/commonsguy/cw-advandroid/tree/master/SystemServices...
Inside the doWakefulWork method of the Service I am instantiating a few classes, but some of them require my Activity to be running. How do I actually start the Activity? The code above only starts the AlarmManager and Service.
There are also times where the Activity *is* already started, like if the user manually opened it. So I also need to start the Activity "only if it's not already running". Hows that work?
And what about the situation where the user first installs your application and may not even reboot their phone for a week. In that case, do you have to start the Service from the Activity? But then the Service will die with the Activity.
View 7 Replies
View Related
Jun 30, 2010
At the beginning Activity is launched by an Intent and something is done with this Intent. When I change orientation of my Activity, it's reloaded again and Intent is passed to the Activity. How can I clear that Intent to prevent Activity from using it again?
View 1 Replies
View Related
Apr 11, 2010
I've got an Android application which needs to be woken up sporadically throughout the day.To do this, I'm using the AlarmManager to set up a PendingIntent and have this trigger a BroadcastReceiver. This BroadcastReceiver then starts an Activity to bring the UI to the foreground.All of the above seems to work, in that the Activity launches itself correctly; but I'd like the BroadcastReceiver to notify the Activity that it was started by the alarm (as opposed to being started by the user). To do this I'm trying, from the onReceive() method of the BroadcastReceiver to set a variable in the extras bundle of the intent,Can anyone tell me what's different about passing a bundle from a BroadcastReceiver to an Activity, as opposed to passing the bundle from an Activity to a BroadcastReceiver?
View 2 Replies
View Related
Apr 6, 2010
i've developed an android app that's fetches an xml file and displays this data via several markers on the map. This works fine so far. The problem right now is that when i switch the orientation of the phone (portrait->landscape or vice versa) the markers disappear for a small moment, the xml processing is started again and then they reappear. Is there a way to prevent this re-loading of the file? It only takes about 2-3 seconds.
View 2 Replies
View Related
Feb 19, 2010
I want to do some data processing (in a thread) right after my main Activity starts. For that data processing to be started I also need to know a visible size of my main View (which is a LinearLayout currently, but whatever).I wonder how to do that. I.e. I wonder what is the entry point (callback?) I should use to be sure that my main View has been layed out, so i can use view.getWidth/getHeight? Is creating a custom View and reimplementing it's onSizeChanged() - the only way? In this case how should I properly describe it in my xml layout file? (it will contain some child views)
View 1 Replies
View Related
Jul 22, 2009
I have one Activity, that starts one Service and my service will lunch one Activity, i wanna to stop the Activity which one started my my Service after few seconds. Is there any way to achieve. Has anyone experienced this type of scenario.
View 2 Replies
View Related
Aug 13, 2010
In my game when the user completes a stage, I want the main game thread to pause/sleep/wait and a new activity to be launched called StageClear that displays information about points scored etc. After this has been displayed and the user has pressed continue I want the original game thread to resume where it left off. I have tried to implement this but have so far been unsuccessful, probably because I'm new to dealing with multiple threads and also the idea of synchronizing them. I most recently tried to implement a shared package-visible object that could notify after wait was called on itself, but I am getting errors in eclipse so it won't even compile, I think because though the object is declared public in an inner class, it cannot be seen or recognised by my activity elsewhere in a file in the package. I have already built both activities but my issue is getting the main game one to launch the other, and pause whilst it waits for this activity to finish, before the main game thread continues execution.
View 1 Replies
View Related
Sep 23, 2010
I have a very simple android project. I got the following error message when I try to run it. The emulator is running but the application doesn't come up. I couldn't find any useful information online.
CODE:..................
View 3 Replies
View Related
Dec 23, 2009
Has anyone got a good solution when the Location manager returns a null? My brain is baked trying to get around this. I know its just a matter of time but do I need to put in a musical interlude? I'm only asking for Coarse Location. Right now I'm just exiting with a Toast but I would rather have a way to hang around and maybe kick the thing into gear. I'm pretty sure this was one of my force close issues but the Toast is just an escape clause. It doesn't solve the problem.
View 5 Replies
View Related
Sep 14, 2010
I have a few activities within an app.
Should i be reusing the same location manager or should i call (LocationManager) this.getSystemService(Context.LOCATION_SERVICE) for each new activities?
View 2 Replies
View Related
Nov 16, 2010
Don't know why, but sometimes LocationManager is still working also after closing application.
I call startGPS() in onCreate-Methode in one Activity (only one, let me call it StartActivity).
CODE:...........
And if this activity will be destroyed (so, when application will be closed), I call endGPS()
CODE:......................
View 2 Replies
View Related