android - Destroy an activity when back button is pressed? -


i have app allows user select txt file list , goes off internet contents of file. works except when user accidentally or deliberately presses hardware button go , see list again.

now, when user clicks new item list (a new file is), instead of loading new file, app continues off suspended.i not want happen. know related life cycle of activity.

how make sure loads new file rather continuing left off ?

i suppose you're loading file in oncreate(). should in onresume() instead.

android application lifecycle

do not force activities close (e.g. use finish()). first, this not guarantee activity closed, , second, better left android decide.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -