0

I have a registration form in android wherein the user can enter data from it. The user can search for Clinic. After that searching, the user submitted the record, and logout. If the user doesn't have no business with that app, the user can exit BUT when the user pressed the Exit button, it does not exiting, instead it goes to the Searching activity all over again even if the user is logout already. Can someone help me figure out why I can't finish my activity?

Search Activity

btn_Close.setOnClickListener(new OnClickListener() {
        public void onClick(View v)
        {
            Intent myIntent = new Intent(getApplicationContext(), RegForm.class);
            myIntent.putExtra("from", "Search_Cancel");

            startActivity(myIntent);
            Search.this.finish();
        }
    });

Android Manifest

    <activity
        android:name=".Search"
        android:noHistory="true" > 
    </activity>
4

2 回答 2

2

活动随着this.finishActivity(Activity.RESULT_OK);通话结束。
注意:您也可以将位于Activity类中的其他结果指定为静态最终结果。

于 2013-08-12T07:38:59.423 回答
1

finish() 将使您的活动活动从后台堆栈中弹出,但您的其他活动将保留在该位置上,因此如果您想退出整个应用程序,您应该在启动最后一个活动时使用标志 FLAG_ACTIVITY_CLEAR_TOP 来清除您的后台堆栈

于 2013-08-12T07:38:46.653 回答