Question

I need to show the image of the user for my chat application, i have the URL and i need to set it as ActionBar Logo, how can i achieve that?

Right now i'm doing this:

imagen = i.getStringExtra("imagen");

String logo[] = imagen.split("/");

String pathName = Environment.getExternalStorageDirectory().getPath()+"/GettfordCommunity/"+logo[7];
Log.i("foto =>", pathName);
Resources res = getResources();
Bitmap bitmap = BitmapFactory.decodeFile(pathName);
BitmapDrawable bd = new BitmapDrawable(res, bitmap);

actionBar.setLogo(bd);

and in the Log i have the right path

foto => /mnt/sdcard/GettfordCommunity/1380141946.jpg

But is not showing the image in the ActionBar.

Appreciate the help

Was it helpful?

Solution

You need to set the flag for using the logo:

actionBar.setDisplayOptions( DISPLAY_USE_LOGO);

and use this for preserving display options:

setDisplayUseLogoEnabled(true);

or else use the drawable to set the icon:

actionBar.setIcon(bd);

you should be good to go....

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top