簡體   English   中英

在Android中支付活動費用后如何完成舊的活動?

[英]how can finish old activites after paying activity in Android?

在我的應用程序中有活動:登錄>搜索>搜索結果列表>項目詳細信息>付款>我的項目詳細信息

當我在“搜索結果列表”中並單擊時,它將返回到“搜索”,在項目詳細信息中相同,它將返回到搜索結果列表

付款后如何完成許多舊活動?

使用可以使用

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent){
super.onActivityResult(requestCode, resultCode, intent);
 if(resultCode==0){
 finish(); 
}
else{
 }
}

然后使用setResult(0); 當您破壞其中的活動時

當您在第一個活動中調用startAcitivty之后完成它時,還有另一種解決方案
第二活動

要完成一項活動,我正在使用以下代碼:

public void AppExit(){
this.finish();
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intetn.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}

or kill Process with this code:

int pid = android.as.Process.myPid();
android.os.Process.KillProcess(pid);

您可以簡單地做到這一點。 當您要啟動一個intent時,請像下面這樣調用finish()方法:

Intent i = new Intent(this,abc.class);
startActivity(i);
finish(); 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM