不知道为啥最近总有人问这个问题 ,可能是用到服务了吧
在你的service中如下使用
@Override
public void onStart(Intent intent, int startId) {
...
Log.i("Service", "onStart() is called");
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
callIntent.setClass(<Set your package name and class name here>);
startActivity(callIntent);
...
}
callIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
callIntent.setClass(<Set your package name and class name here>);
这两句才是最主要的
本文介绍了如何在Android服务(Service)中通过Intent调用另一个Activity的方法。具体实现包括设置Intent标志符和指定要调用的组件名称。
3416

被折叠的 条评论
为什么被折叠?



