android - Why can't we just call new Activity() -


so, kind of noob situation, today, out of curiosity, tried like:

new activity().runonuithread( new runnable{...})

mostly because don't have access activities (working on 3rd party library). have applicationcontext, don't think allows me make runonuithread call.

so guess i'm kind of wondering if there way somehow fake out minimally-invasive activity can run on ui thread (or other things, pop dialog...etc.) ??

if not, know what's wrong making new activity() ? ( mean, aside fact that, yes, null pointer because haven't set base context since oncreate activity never got called ). if possible, accept answer can provide little more detail , more "context" (no pun intended)

new handler(context.getmainlooper()).post(new runnable() {     @override     public void run()     {     } }); 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -