I use OkHttp in a separate service to fetch data from the twitter API.
I have been trying to Alert the user that tweets cannot be loaded without an internet connection. But when i try this, the application crashes.The error is
java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare().
Here's my code
 private void getTweets(final String topic) {
    final TwitterService twitterService = new TwitterService();
    twitterService.findTweets(topic, new Callback() {
        @Override
        public void onFailure(Request request, IOException e) {
            e.printStackTrace();
            Log.e("Traffic Activity", "Failed to make API call");
            Toast.makeText(getApplicationContext(), "Bigger fail", Toast.LENGTH_LONG).show();
        }
 
     
    