我正在尝试写一个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中运行上面的代码时,我得到“没有应用程序可以执行此操作”。我应该在代码中更改什么,或者我应该添加任何插件
发布于 2014-10-05 19:16:13
要在模拟器中使用Google API-s,您必须使用包含Google API-s的模拟器图像。
对于Android 4.4.2 (API 19),目前有4个可用的镜像:
只有后两个支持Google API(包括Google Maps),前两个是AOSP图像。
要使用Google API,首先必须使用Google API安装图像(为了提高速度,请尽可能使用HAX的x86图像)。然后在使用AVD管理器创建虚拟设备时,选择此镜像作为“目标”。
https://stackoverflow.com/questions/26201284
复制相似问题