想意圖相同的活動,如MainActivity-> MainActivity代替MainActivity-> SecondActivity我怎麼意圖相同的活動,而不是第二個活動
她是我的代碼,但它不工作,就會停止我的應用程序,如何解決它
public class AddasMessage extends AsyncTask<AddMessage,Long,JSONArray>
{
ProgressDialog dialog = new ProgressDialog(FriendDetailsActivity.this);
protected void onPreExecute(){
dialog.setMessage("Adding...");
dialog.show();
}
@Override
protected JSONArray doInBackground(AddMessage... params) {
// it is executed on Background thread
return params[0].AddtobeMessage();
}
@Override
protected void onPostExecute(JSONArray jsonArray) {
Log.i("Main activity", String.valueOf(jsonArray));
dialog.dismiss();
Intent intent = new Intent(getBaseContext(), FriendDetailsActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Context context = getApplicationContext();
CharSequence text = "You are success to send the message!";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
}
放logcat的!!!!! –
[Android返回相同的活動完成舊版本]的可能重複(http://stackoverflow.com/questions/24890181/android-return-to-same-activity-finish-old-one) – 2016-04-22 11:09:13
04-22 07:11 :23.210 1874-1874/slidenerd.vivz.navigationviewdemo E/AndroidRuntime:在slidenerd.vivz.view.FriendDetailsActivity.onCreate(FriendDetailsActivity.java:75) – bbbb