我是新来的android请帮忙。 我试过用这个代码......
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + number));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_FROM_BACKGROUND);
startActivity(intent);
没有用:它突然停了下来。 我提到了必要的权限
请尝试下面的代码。
new Handler().post(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setData(Uri.parse("tel:" + number));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_FROM_BACKGROUND);
context.startActivity(intent);
}
});
您将从服务qazxsw poi方法获得上下文。在qazxsw poi的地方,可以使用qazxsw poi