Skip to content

Commit

Permalink
Fixed concurrent access crash
Browse files Browse the repository at this point in the history
  • Loading branch information
andreybutenko committed Sep 15, 2017
1 parent 6261d81 commit a0a17a8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/src/main/java/ninja/andrey/lyriclink/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,17 @@ public void onSearchUrlLoaded(String url) {
userData.setLatestLyricLookupTime(System.currentTimeMillis());

dismissLoadingDialog();
Search.removeListener(MainActivity.this);
Intent intent = Search.getLyricIntent(url);
startActivity(intent);

Timer timer = new Timer();
TimerTask timerTask = new TimerTask() {
@Override
public void run() {
Search.removeListener(MainActivity.this);
}
};

timer.schedule(timerTask, TIMER_RATE);
}
}

0 comments on commit a0a17a8

Please sign in to comment.