I've been on this for over a week. I've tried setting up a Google maps activity in my app with no luck. I also see you can call on the Google map app from your application. By using a Onclicklistener. How do I open the Google Maps app from my app using a button? This is the code I'm using...
import com.google.android.maps.GeoPoint;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class Store10 extends Activity {
Context context;
GeoPoint geo;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.store10);
Button num10 = (Button) findViewById(R.id.pNumber10);
Button nav10 = (Button) findViewById(R.id.Map10);
num10.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
// TODO Auto-generated method stub
Intent myIntent = new Intent(view.getContext() ,Num10.class);
startActivityForResult(myIntent, 0);
}
});
nav10.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
// TODO Auto-generated method stub
String uri = String.format("geo:%f,%f",40,325874,76,002211);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
context.startActivity(intent);
}
});
}
}
Here's the Onclicklistener I'm trying to set up
nav10.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
// TODO Auto-generated method stub
String uri = String.format("geo:%f,%f",40,325874,76,002211);
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
context.startActivity(intent);
}
});