Example usage for android.app Fragment getString

List of usage examples for android.app Fragment getString

Introduction

In this page you can find the example usage for android.app Fragment getString.

Prototype


public final String getString(@StringRes int resId, Object... formatArgs) 

Source Link

Document

Return a localized formatted string from the application's package's default string table, substituting the format arguments as defined in java.util.Formatter and java.lang.String#format .

Usage

From source file:com.android.packageinstaller.permission.ui.PermissionAppsFragment.java

private static void bindUi(Fragment fragment, PermissionApps permissionApps) {
    final Drawable icon = permissionApps.getIcon();
    final CharSequence label = permissionApps.getLabel();
    final ActionBar ab = fragment.getActivity().getActionBar();
    if (ab != null) {
        ab.setTitle(fragment.getString(R.string.permission_title, label));
    }//from   www  .ja  va 2 s  . c o m

    final ViewGroup rootView = (ViewGroup) fragment.getView();
    final ImageView iconView = (ImageView) rootView.findViewById(R.id.lb_icon);
    if (iconView != null) {
        // Set the icon as the background instead of the image because ImageView
        // doesn't properly scale vector drawables beyond their intrinsic size
        iconView.setBackground(icon);
    }
    final TextView titleView = (TextView) rootView.findViewById(R.id.lb_title);
    if (titleView != null) {
        titleView.setText(label);
    }
    final TextView breadcrumbView = (TextView) rootView.findViewById(R.id.lb_breadcrumb);
    if (breadcrumbView != null) {
        breadcrumbView.setText(R.string.app_permissions);
    }
}