Public static void showMapAtLat LongActivity activity

Intent intent = new Intent(Intent.ACTION_VIEW); //geo:lat,long?z=zoomlevel&q=question-string intent.setData(Uri.parse("geo:0,0?z=4&q=business+near+city")); activity.startActivity(intent);

public static void tryOneOfThese(Activity activity) {;

You will be able to exercise this code as long you have a simple activity with a simple view (like the one in the previous section) and a menu item to invoke tryOneOfThese(activity). Creating a simple menu is easy (see Listing 3-33).

Listing 3-33. A Test Harness to Create a Simple Menu public class HelloWorld extends Activity {

public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

TextView tv = new TextView(this); tv.setText("Hello, Android. Say hello"); setContentView(tv); registerMenu(this.getTextView());

^Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); int base=Menu.FIRST; // value is 1 Menultem iteml = menu.add(base,base,base,"Test"); return true;

^Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == 1) {

0 0

Post a comment