Context getResources - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Context getResources method.

This code example shows how to use the following methods:getResources
        } 
    } 
 
    /** Start the actual synchronization */ 
    private void startSynchronization(Context context) {
        if(context == null || context.getResources() == null)
            return; 
 
        ContextManager.setContext(context);
 
        if(!getSyncUtilities().isLoggedIn()) 
            return; 
 
        getSyncProvider().synchronize(context);
    } 
 
    @Override 
    public IBinder onBind(Intent intent) {
        return null; 
    } 
8
CodeRank
This code example shows how to use the following methods:getResources
        toast.setView(view);
        return toast;
    } 
 
    public static Toast makeText(Context context, int resId, int duration) {
        return makeText(context, context.getResources().getString(resId), duration);
    } 
 
    public IcsToast(Context context) {
        super(context);
    } 
 
    @Override 
    public void setText(CharSequence s) {
        if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) {
            super.setText(s);
            return; 
        } 
        if (getView() == null) {
            return; 
8
CodeRank
This code example shows how to use the following methods:getResources
public class FragmentPopover extends QuickActionWidget { 
 
    protected DisplayMetrics metrics;
 
    public FragmentPopover(Context context, int layout) {
        super(context);
        setContentView(layout);
 
        metrics = context.getResources().getDisplayMetrics();
 
        setFocusable(true); 
        setTouchable(true); 
    } 
 
    public void setContent(View content) {
        FrameLayout contentContainer = (FrameLayout) getContentView().findViewById(R.id.content);
        contentContainer.addView(content);
    } 
 
    public void setContent(View content, LayoutParams params) {
8
CodeRank
This code example shows how to use the following methods:getApplicationContext, getResources, getSharedPreferences
 
    private LocalBluetoothPreferences() { 
    } 
 
    private static SharedPreferences getSharedPreferences(Context context) {
        return context.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_PRIVATE);
    } 
 
    static long getDiscoverableEndTimestamp(Context context) {
        return getSharedPreferences(context).getLong(
                KEY_DISCOVERABLE_END_TIMESTAMP, 0);
    } 
 
    static boolean shouldShowDialogInForeground(Context context,
            String deviceAddress) {
        LocalBluetoothManager manager = LocalBluetoothManager.getInstance(context);
        if (manager == null) {
            return false; 
        } 
 

8
CodeRank
This code example shows how to use the following methods:getApplicationInfo, getPackageName, getResources, getSystemService
/* 
*    This file is part of GPSLogger for Android. 
* 
*    GPSLogger for Android is free software: you can redistribute it and/or modify 
*    it under the terms of the GNU General Public License as published by 
*    the Free Software Foundation, either version 2 of the License, or 
*    (at your option) any later version. 
* 
*    GPSLogger for Android is distributed in the hope that it will be useful, 
*    but WITHOUT ANY WARRANTY; without even the implied warranty of 
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
*    GNU General Public License for more details. 
* 
*    You should have received a copy of the GNU General Public License 
*    along with GPSLogger for Android.  If not, see <http://www.gnu.org/licenses/>. 
*/ 
 
package com.mendhak.gpslogger.senders.gdocs; 
 
import android.content.Context; 

8
CodeRank
This code example shows how to use the following methods:getResources, getSystemService
    private boolean shouldLoadImages = true;
    private final DisplayMetrics displayMetrics;
 
    public PhotoSelectCursorAdapter(Context context, Cursor c) {
	super(context, c);
	inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	loader = ImageLoader.getLoader(context);
	dataIndex = c.getColumnIndex(MediaStore.Images.Media.DATA);
	displayMetrics = context.getResources().getDisplayMetrics();
	tick = new HashMap<Integer, String>();
    } 
 
    public static class ViewHolder { 
	public ImageView image;
	public ImageView tick;
    } 
 
    @Override 
    public void bindView(View view, Context context, Cursor cursor) {
	ViewHolder holder = (ViewHolder) view.getTag();
8
CodeRank
This code example shows how to use the following methods:getResources, get
    public int getMaxActionButtons() { 
        return mContext.getResources().getInteger(R.integer.max_action_buttons);
    } 
 
    public boolean showsOverflowMenuButton() { 
        return !ViewConfiguration.get(mContext).hasPermanentMenuKey() ||
                ((mContext.getResources().getConfiguration().uiMode &
                        Configuration.UI_MODE_TYPE_TELEVISION) ==
                        Configuration.UI_MODE_TYPE_TELEVISION);
    } 
 
    public int getEmbeddedMenuWidthLimit() { 
        return mContext.getResources().getDisplayMetrics().widthPixels / 2;
    } 
 
    public boolean hasEmbeddedTabs() { 
        final int targetSdk = mContext.getApplicationInfo().targetSdkVersion;
        if (targetSdk >= Build.VERSION_CODES.JELLY_BEAN) {
            return mContext.getResources().getBoolean(R.bool.action_bar_embed_tabs);
        } 
7
CodeRank
This code example shows how to use the following methods:getResources, getTheme
7
CodeRank
This code example shows how to use the following methods:getPackageName, getResources, getString
     * @param resourceName 
     * @param resourceType 
     * @return 
     */ 
    public static int getDynamicResourceId(Context context, String resourceName, String resourceType) {
        return context.getResources().getIdentifier(resourceName, resourceType, context.getPackageName());
    } 
     
    /** 
     * Gets resource string dynamically 
     *  
     * @param context 
     * @param resourceName 
     * @return 
     */ 
    public static String getDynamicResourceString(Context context, String resourceName) {
        int resourceId = getDynamicResourceId(context, resourceName, "string");
        return context.getString(resourceId);
    } 
} 

7
CodeRank
This code example shows how to use the following methods:getResources
    public ActionMenuView(Context context) {
        this(context, null);
    } 
 
    public ActionMenuView(Context context, AttributeSet attrs) {
        super(context, attrs);
        setBaselineAligned(false); 
        final float density = context.getResources().getDisplayMetrics().density;
        mMinCellSize = (int) (MIN_CELL_SIZE * density);
        mGeneratedItemPadding = (int) (GENERATED_ITEM_PADDING * density);
    } 
 
    public void setPresenter(ActionMenuPresenter presenter) {
        mPresenter = presenter;
    } 
 
    public boolean isExpandedFormat() { 
        return mFormatItems;
    } 
 
8
CodeRank

Related Context getResources Questions & Answers:

getResources Method Overview
Return a Resources instance for your application's package.
See Code Examples for other Android Context Methods: