Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. WebAppInterface(Context c, Response response) {
  2. activity = (Activity) c;
  3. delegate = response;
  4. context = c;
  5. }
  6.  
  7. /** Show a toast from the web page */
  8. @JavascriptInterface
  9. public void getResponse(final String operation, final String response, final String type) {
  10. final Handler mainHandler = new Handler(context.getMainLooper());
  11. mainHandler.post(new Runnable() {
  12. @Override
  13. public void run() {
  14. delegate.didGetResponse(operation, response, type);
  15. Log.d("Success: ", "Im still here"); <-- why am I not back in main thread?
  16. }
  17. });
  18. }
  19.  
  20. public interface Response {
  21. public void didGetResponse(String operation, String response, String type);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement