Skip to content

Commit

Permalink
Toast now runs on UI thread
Browse files Browse the repository at this point in the history
  • Loading branch information
jrejaud committed Dec 30, 2015
1 parent f083331 commit 37a32f8
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,13 @@ public void run() {
String nodeID = findBestNodeId(nodes);
Log.d(TAG,"Node found: "+nodeID);
if (nodeID==null) {
String message = "Error, cannot find a connected device";
Toast.makeText(context,message,Toast.LENGTH_SHORT).show();
final String message = "Error, cannot find a connected device";
((Activity)context).runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
}
});
new Throwable(message);
return;
}
Expand Down

0 comments on commit 37a32f8

Please sign in to comment.