get Notification Icon - Android Android OS

Android examples for Android OS:Notification

Description

get Notification Icon

Demo Code


//package com.java2s;

import android.content.Context;

import android.content.pm.PackageManager;

public class Main {
    private static int getNotificationIcon(Context paramContext) {
        int i = getResourceId(paramContext,
                "com_sina_weibo_sdk_weibo_logo", "drawable");
        if (i > 0)
            return i;
        return 17301659;
    }/*from   w  w  w.j  a v  a 2s  . c o m*/

    private static int getResourceId(Context paramContext,
            String paramString1, String paramString2) {
        String str = paramContext.getApplicationContext().getPackageName();
        PackageManager localPackageManager = paramContext
                .getPackageManager();
        try {
            int i = localPackageManager.getResourcesForApplication(str)
                    .getIdentifier(paramString1, paramString2, str);
            return i;
        } catch (PackageManager.NameNotFoundException localNameNotFoundException) {
            localNameNotFoundException.printStackTrace();
        }
        return 0;
    }
}

Related Tutorials