What is Application Class in Android
create class by extend Application, in which we put data like String, Array or other type and access in All Activities.public class MyApplication extends Application {
public static MyApplication Instance = null;
public static MyApplication getInstance() {
return Instance;
}
public String name=""; // example save name in this class
public String getName() {
return name; // create getter and setter Method of name.
}
public void setName(String name) {
this.name = name;
}
}
Save Value in Application Class
MyApplication.getInstance().setName("Hello"); // save Hello name
Get Save Value in Application Class
MyApplication.getInstance().getName(); // get save name
Register Application class in Manifest
inside application tag<application
android:name=".MyApplication" // application class name
.............................................................
..............................................................
...</application>