Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

runOnUiThread without Activity [duplicate]

I have created an java class in android studio and I want to use runOnUiThread() in this class. Can I run runOnUiThread() thread without Activity.xml in Android? If Answer is yes? than how?

like image 594
nisarg parekh Avatar asked Dec 23 '22 05:12

nisarg parekh


1 Answers

Yes. You just need to use Handler.

 new Handler(Looper.getMainLooper()).post(new Runnable() {
                @Override
                public void run() {

                }
            });
like image 72
Zeon Avatar answered Dec 28 '22 10:12

Zeon