Hey guys I am new to android development, I am currently making an application.The main activity has a list view and all the items are getting displayed in the list view, as they should.Now if any item is clicked or if a new item is added, a new activity is opened up and gets destroyed if the back button is pressed.Now when the main activity is reached and the back button is again pressed to close the application , it instead of closing the application , moves again to the main activity,only this time, the last entry added is not present, similarly on continuously pressing the back button all the entries first get removed, and when all the entries get removed, the main activity closes and the application stops. Any idea why this is happening, I could really use your help. Thanks.
Hey guys I am new to android development, I am currently making an application.The
Share
You need to add
android:noHistory="true"to your list detail Activity in the AndroidManifest.xmlFor example:
Alternatively, you could override the onBackPressed method to finish the activity when you press the button.