0
我想写一个Android应用程序,它将包含3个按钮,即启动谷歌地图,启动市场和发送电子邮件。我的代码如下:启动谷歌地图
public class Intents extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_intents);
}
public void process(View button){
Intent intent=null,chooser=null;
if(button.getId()==R.id.LaunchMap){
intent=new Intent(android.content.Intent.ACTION_VIEW);
intent.setData(Uri.parse("geo:" + latitude + "," + longitude));
chooser=Intent.createChooser(intent, "Launch Google Maps");
startActivity(chooser);
}else if(button.getId()==R.id.LaunchMarket){
intent=new Intent(android.content.Intent.ACTION_VIEW);
intent.setData(Uri.parse("market:https://details?id=dolphin.developers.com"));
chooser=Intent.createChooser(intent, "Launch Market");
startActivity(chooser);
}else if(button.getId()==R.id.SendEmail){
}
}
}
但是,当我在eclipse中运行上述代码我得到“没有应用程序可以执行此操作”。我应该在代码中更改哪些内容或者是否存在我应该添加的任何插件
在什么时候你会得到这个错误?编译时,在模拟器中启动应用程序时,单击按钮或其他东西时? – Okas 2014-10-05 09:26:55
当我按下模拟器上的按钮 – lil 2014-10-05 09:47:37
请确保您使用包含谷歌地图的模拟器图像。 – Okas 2014-10-05 10:12:29