android - Should we have a static final handler in utility class -


i'm going write utility class reporting error messages posting messages via internet. can used classes , anywhere in app. , i'm going this:

public class reporter {     private static final handler reporter_handler = new handler();      private reporter(){}      public static void report(final exception e) {         reporter_handler.post(new runnable() {             @override             public void run() {                 // using httpurlconnection post message server.             }         });     } } 

should this, think it's not idea, can tell me how improve code.

it seems me missing concept of handler. not need handler @ all, @ least in use case mention.

if you'd post action time later - handler appropriate.

if you'd perform action on ui thread when code being run on other thread - handler appropriate.

but in use case have perform operation, doesn't need interact handler @ all.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -