This is where I plan to put notes (quickly) before I put the information in better places around this site. This is bascially a scratchpad page ...

Random Notes


  • -life cycle

map1 try { Intent myIntent = new Intent(android.content.Intent.VIEW_ACTION, new ContentURI("geo:38.899533,-77.036476")); startActivity(myIntent); } catch (URISyntaxException e) { }
startSubActivity(new Intent(this, MySecondActivity.class), 0);
simulate incoming call:
telnet localhost 5554 gsm call 12345
Hi There, I don't know about the phone number off the top of my head, but here's what I've learnt from my experience with getting GPS location: *** Get GPS Location of Device *** 1. The first thing you need to do is get a handler to the LocationManager system service: //Get handler to system location manager LocationManager locMan = (LocationManager) getSystemService(Context.LOCATION_SERVICE); 2. Then you need to get a LocationProvider (an object that provides periodic reports on the geographical location of the device): // Get the first provider available List providers = locMan.getProviders(); LocationProvider provider = providers.get(0); This will get the first provider available, which should be the default gps provider that comes with the emulator (and isn't too useful - you'll be better off creating your own mock provider - which I'll happily explain how to do on request). Note: instead of working this way you can request a LocationProvider based on a minimum Criteria it must meet using the method: getBestProvider(Criteria criteria). 3a. You can then either simply query the current location using: //Returns a new location fix from the given provider Location curLoc = locMan.getCurrentLocation(provider.getName()); 3b. Or register for periodic location updates using the method of the LocationMananger: requestUpdates(LocationProvider provider, long minTime, float minDistance, Intent intent) Which receives updates by you creating a IntentReceiver that listens for intents of the type passed into the method. The current location data can then be retrieved from the fired Intent as a Location object by calling intent.getExtra("location"). I won't explain this in great detail right now, but if you do want to know more just ask. 4. If you're going to use the Location with a MapView you'll then need to 'wrap' it in a Point by using: Point curLocAsPoint = new Point((int)(curLoc.getLatitude() * 1000000), (int)(curLoc.getLongitude() * 1000000)); But that's optional depending on what you're doing. *** End *** Some good pages to look at are: And there's a good example of a location based map application at in the Map Applications section. If you need any more help, please feel free to ask. Regards, Steve
Try the WebView class. See I think you can open a website with loadUrl("") . If you just want to launch the browser to a URL you can create an launch an intent similar to: Intent myIntent = new Intent(Intent.VIEW_ACTION,ContentURI.create("")); startActivity(myIntent); to do user input - common layout objects, view groups - designing screen in xml application building blocks: - AndroidManifest.xml - Developing Responsive Applications That is, don't spawn Activities from IntentReceivers or Services running in the background. Doing so will interrupt whatever application is currently running, and result in an annoyed user. Perhaps even worse, your Activity may become a "keystroke bandit" and receive some of the input the user was in the middle of providing to the previous Activity. Depending on what your application does, this could be bad news. nstead of spawning Activities directly from the background, you should instead use the NotificationManager to set Notifications. These will appear in the status bar, and the user can then click on them at his leisure, to see what your application has to show him. (Note that all this doesn't apply to cases where your own Activity is already in the foreground: in that case, the user expects to see your next Activity in response to input.)