How to declare Global variables in Android?
How to declare Global variables in Android?
Here's how to declare global variables in Android:
Create a custom Application class
android.app.Application.Override the onCreate() method
onCreate() method and initialize your global variables.Register the custom Application class in the manifest
AndroidManifest.xml file.<application> tag.android:name attribute and set it to the fully qualified name of your custom Application class.Example:
public class MyApplication extends Application {
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.