Android Open Source - appboy-android-sdk Xml U I Configuration Provider

From Project

Back to project page appboy-android-sdk.


The source code is released under:

Copyright (c) 2014 Appboy, Inc. All rights reserved. * Use of source code or binaries contained within Appboy's Android SDK is permitted only to enable use of the Appboy platform by customers of Appb...

If you think the Android project appboy-android-sdk listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.appboy.ui.configuration;
//w w w .  j  a  v  a2  s  .c o m
import android.content.Context;
import android.util.Log;

import com.appboy.Constants;
import com.appboy.configuration.CachedConfigurationProvider;

public class XmlUIConfigurationProvider extends CachedConfigurationProvider {
  private static final String TAG = String.format("%s.%s", Constants.APPBOY_LOG_TAG_PREFIX, XmlUIConfigurationProvider.class.getName());
  private static final String APPLICATION_ICON_KEY = "application_icon";

  private final Context mContext;

  public XmlUIConfigurationProvider(Context context) {
    mContext = context;

  public int getApplicationIconResourceId() {
    if (mConfigurationCache.containsKey(APPLICATION_ICON_KEY)) {
      return (Integer) mConfigurationCache.get(APPLICATION_ICON_KEY);
    } else {
      String packageName = mContext.getPackageName();
      int resourceId = 0;
      try {
        ApplicationInfo applicationInfo = mContext.getPackageManager().getApplicationInfo(packageName, 0);
        resourceId = applicationInfo.icon;
      } catch (PackageManager.NameNotFoundException e) {
        Log.e(TAG, String.format("Cannot find package named %s", packageName));
      mConfigurationCache.put(APPLICATION_ICON_KEY, resourceId);
      return resourceId;

Java Source Code List