I am trying to load the logo associated with the current activity and/or its 
parent application from the definition in the manifest. This technique has 
already worked successfully on loading the title and icon associated with 
both, but the logo is always returning null or 0.

Here is the relevant info from the manifest I am working with:

<application
android:icon="@drawable/ic_launcher"
android:logo="@drawable/ad_logo"
android:label="@string/app_name"
android:hardwareAccelerated="true">
 <activity
android:name=".MainActivity" 
android:label="@string/app_name"
android:logo="@drawable/ad_logo">

With activity being an instance of the above defined activity, I have tried 
the following (*results annotated inline*):

PackageManager pm = activity.getPackageManager();
ComponentName cn = activity.getComponentName();
ApplicationInfo ai = activity.getApplicationInfo();

//ACTIVITY LABEL: Works
pm.getActivityInfo(cn, PackageManager.GET_ACTIVITIES).loadLabel(pm);

//APPLICATION LABEL: Works
ai.loadLabel(pm);
//APPLICATION LABEL: Works
pm.getApplicationLabel(ai);

//ACTIVITY ICON: Works
pm.getActivityInfo(cn, PackageManager.GET_ACTIVITIES).loadIcon(pm);
//ACTIVITTY ICON: Works
pm.getActivityIcon(cn);

//APPLICATION ICON: Works
pm.getApplicationIcon(ai);
//APPLICATION ICON: Works
ai.loadIcon(pm);

//ACTIVITY LOGO: Does not work
pm.getActivityInfo(cn, PackageManager.GET_ACTIVITIES).loadLogo(pm);
//ACTIVITY LOGO: Does not work
pm.getActivityLogo(cn);

//APPLICATION LOGO: Does not work
pm.getApplicationLogo(ai);
//APPLICATION LOGO: Does not work
pm.getApplicationLogo(activity.getApplication().getPackageName());
//APPLICATION LOGO: Does not work
ai.loadLogo(pm);

//APPLICATION LOGO: Does not work
pm.getApplicationInfo(ai.packageName, 0).loadLogo(pm);
//APPLICATION LOGO: Does not work
ai.logo;

Does anyone know how to properly load the logo for either or both of these 
targets?

FYI, this is also a StackOverflow 
quesion<http://stackoverflow.com/questions/6105504/load-activity-and-or-application-logo-programmatically-from-manifest>(with
 a bounty!)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to