I'd like to read the string in xml. I need a lot from the widget, so can I call getResource and get it without an activity object?
android java static const android-resources
public class App extends Application{
private static Context mContext;
@Override
public void onCreate() {
super.onCreate();
mContext = this;
}
public static Context getContext(){
return mContext;
}
}
If you do this, you can get context values at any time using the App.getContext() method. And App.getContext().You can get the value of getResource with getResource().
© 2024 OneMinuteCode. All rights reserved.