By using information in stackoverflow I finally could write a code that receive an image from URL and set it as hamburger menu icon in navigation drawer by using Picasso . It works very well . But still there is a problem : ( when installing the app for the first time and run it ) OR ( when turning off the mobile and then rerun the app ) , the icon is not shown . When rerun the app ( before turning off the mobile ) , the app run correctly and icon is shown . How I can solve this problem?
{
final Target mTarget = new Target() {
@Override
public void onBitmapLoaded(Bitmap bitmap,Picasso.LoadedFrom loadedFrom) {
Log.d("DEBUG", "onBitmapLoaded");
Bitmap scaledBitmap = Bitmap.createScaledBitmap(bitmap, 100, 100, false);
mBitmapDrawable = new BitmapDrawable(getResources(), scaledBitmap);
getSupportActionBar().setHomeAsUpIndicator(mBitmapDrawable);
}
@Override
public void onBitmapFailed(Exception e, Drawable errorDrawable) {
}
@Override
public void onPrepareLoad(Drawable drawable) {
Log.d("DEBUG", "onPrepareLoad");
}
};
Picasso.get().load("http://192.168.1.53:8080/Farid/1.jpg").into(mTarget);
}
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);