is there way to access main context without don't sent context? on android -


i made custom class called "customclass".

basically, send main context follow in

in mainactivity,

customclass cclass = new customclass(this); 

in customclass,

public customclass(context context){   this.context = context; } 

but, don't want send context in mainactivity.

just call constructor in mainactivity,

customclass cclass = new customclass(); 

and customclass got context of mainactivity.

does know how this?

oh!, don't want these way. such write

android:name ="com.example.customclass" 

in manifest.xml

make application baseapplication have make method.

then add mainactivity in it. , use in customclass.

or can use application context instead of mainactivity.

depends on using what.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -