In my application I\'m using toolbar
which having imageview
in it. I need to change that imageview dynamically .
Here is my toolbar.xm
Try this
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
toolbar.setNavigationIcon(getResources().getDrawable(R.drawable.back_arrow));
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
As per my comment Try this :
final ImageView imageInToolbar = (ImageView) toolbar.findViewById(R.id.actionBarImage);
setSupportActionBar(toolbar);
imageInToolbar.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.abc));
For loading image from server :
For Glide use :
Glide.with(this)
.load(url)
.into(imageInToolbar);
In gradle : compile 'com.github.bumptech.glide:glide:3.8.0'
For picasso use :
Picasso.with(this).load(url).into(imageInToolbar);