Android App re-opens upon "back-out"
On my application when I back out of the menu screen to leave the application it re-opens and displays one of the Views that are further into the app than the main menu. On my debugger it says simply
06-08 11:00:53.952: INFO/ActivityManager(120): Displayed activity com.app/mainmenu: 1653 ms (total 1653 ms)
//I press back to leave the app back to the main screen
06-08 11:00:58.112: INFO/ActivityManager(120): Starting activity: Intent { cmp=com.app/gridview (has extras) }
No explaination as to why it is opening that screen.
I have placed this Method (possibly the wrong technical term) in both of the activities that are involved.
@Override
public void onBackPressed() {
// TODO Auto-generated method stub
super.onBackPressed();
finish();
}
Any ideas as to why it might be doing this? I have considered inserting some sort of "kill-app" code but I have read that it's ill-advised.
update; thanks for the suggestion inazaruk, I removed the onBackPressed() override on both screens and it does the same thing.
If I am using the wrong terms when searching for a way to solve this, someone please advise. I do like solving things on my own. When I use the keywords (the tags that are linked to this article) I get alot of message boards for users and not a lot of development boards. (I throw in the word Java and developer sometimes, but they yield results far from what I am looking for)
update 2: looks like I should take a look at something referenced here How can I programmatically close an application? my gridview may be doing some things wrong.
Another update:
<activity android:name=".Menu" android:label="@string/app_name"
android:configChanges="orientation"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
&l开发者_JS百科t;category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".mImageGridview"
android:configChanges="orientation"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="com.hagsvision.mImageGridview" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
possible that "default"?
I should try that on a lady "hey baby. Show me your manifest"
Solved it, on the main menu I was incorrectly implementing an onTouchListener. When I press the back button it apparently qualifies as an "onTouch" and it went to a default selection. I changed it to implement a onClick listener and it functions properly now.
I also removed the category.DEFAULT from the manifest though I don't think that it was the problem.
Solved it, on the main menu I was incorrectly implementing an onTouchListener. When I press the back button it apparently qualifies as an "onTouch" and it went to a default selection. I changed it to implement a onClick listener and it functions properly now.
精彩评论