1
runOnUiThread(new Runnable() {
    @Override public void run() {
    channelAdapter.notifyDataSetChanged();
    stopActivityIndicator();
    setChannel(0);
    }
});

i have added this code in my activity and when back press finish activity then my main activity is block all User Interface, i don't know why this happen.

Pierre de LESPINAY
  • 44,700
  • 57
  • 210
  • 307
Gaurav Mandlik
  • 525
  • 1
  • 9
  • 42
  • Why are you calling notifyDataSetChanged in onBackPress? What is the use case? Are you performing any heavy operations in runOnUIThread block ? – drulabs Apr 11 '16 at 07:20
  • i am not calling notifyDataSetChanged in onBackPress. i calling notifyDataSetChanged in my runOnUiThread() as above on my activity onBackPress i just write finish(), – Gaurav Mandlik Apr 11 '16 at 07:30
  • it will be helpful to see a error stacktrace, please provide... – Opiatefuchs Apr 11 '16 at 07:35
  • 1
    you should call this via handler and a global runnable. Then you can call yourHandler.removeCallbacks(yourRunnable). Then you should be able to exit the app without blocking all... – Opiatefuchs Apr 11 '16 at 07:37
  • There is no any error display on stacktrace, on my back activity is open and i can't interact with the User interface. – Gaurav Mandlik Apr 11 '16 at 08:51
  • i test my app using creating handler and runnable object as globally and on backpress removeCallbacks(handler). then app is crash, the error is look like this - Can't create handler inside thread that has not called Looper.prepare(), Thanks for the response – Gaurav Mandlik Apr 11 '16 at 09:24

0 Answers0