Is there a way to get context without going through the Android onCreate method?

Asked 2 years ago, Updated 2 years ago, 26 views

Is there a way to get context without going through the Android onCreate method?

android

2022-09-22 13:45

2 Answers

If it is a method commonly used in two activities, how about making it into Class separately?

ex)


public void method(Context context){
    // // Todo: code
}

In this way, the method is made into a separate Class and delivered Context...!


2022-09-22 13:45

http://stackoverflow.com/a/38931824/1025379 There's a way like this. I'm using this method, too.


2022-09-22 13:45

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.