I am using picasso to save image to disk on tap of a button by the user and I want to generate a feedback in the form of a Toast to the user that the image has been downloaded.
For this, I am trying to run a toast on the UI Thread by using the following code::
((AppCompatActivity)context).runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
}
});
Which is not running. The image is downloaded and is also visible in the gallery of my app, but the Toast Does not show up. Can someone tell me if I am actually doing this right or should it be done some other way?
FYI: This code is being run in the onBitmapLoaded() method of Target object that I am passing to Picasso to download the Image into; The 'context' object here refers to the current Activity's context.
Any help would be appreciated :)