2
在我的Android應用程序中,我使用implicit intent
來打開location service
。我想在打開service
後重新啓動應用程序。我如何檢查location service
的結果並重新啓動我的app
。Android中的隱含意圖問題
我用下面的代碼
AlertDialog.Builder dialog = new AlertDialog.Builder(Splash.this);
dialog.setMessage("Location not enabled");
dialog.setPositiveButton("open settings",
new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface paramDialogInterface,int paramInt)
{
// TODO Auto-generated method stub
Intent myIntent = new Intent(
android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(myIntent);
}
});
dialog.setNegativeButton("cancel",
new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface paramDialogInterface, int paramInt)
{
// TODO Auto-generated method stub
finish();
}
});
dialog.show();
我要重新啓動我的activity
當我使用下面的代碼按back button
從location service
。
Intent myIntent = new Intent(
android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);
startActivity(myIntent);
謝謝。
發佈您的logcat。 –
logcat中沒有問題。我想在啓動屏幕打開位置服務之後加載MainActivity。但它仍然在飛濺活動,同時按位置服務頁面上的按鈕。然後關閉應用程序並再次打開,現在它轉到MainActivity。 – krishna