android - Execute code every time the application begins -


i execute code every time application begins (not first time application begins getsharedpreferences doesn't help).

i've tried write code in onstart() of main activity, code executed everytime entered activity including times activity other activities (so onstart() doesn't help).

if can direct me this, i'll appreciate that. thanks.

create application class - everytime application opens execute oncreate method.

//note extends application , not activity. public class myapplication extends application {   @override public void oncreate() {     super.oncreate();    //put code here. } 

make sure register in manifest -

   <application     android:name=".myapplication" 

any code put in oncreate execute when app opened.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -