Context getAssets - 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 getAssets method.

This code example shows how to use the following methods:getAssets
     * @param context 
     * @param name 
     * @return typeface 
     */ 
    public static Typeface getTypeface(final Context context, final String name) {
        return Typeface.createFromAsset(context.getAssets(), name);
    } 
} 
7
CodeRank
This code example shows how to use the following methods:getAssets
            super.setText(text.toString().toUpperCase(), type);
        } 
    } 
 
    private void setTF(Context context) {
        setTypeface( Typeface.createFromAsset(context.getAssets(), "fonts/Roboto-Regular.ttf") );
    } 
 
 
} 
7
CodeRank
This code example shows how to use the following methods:getAssets
        return path;
    } 
 
    @Override 
    public InputStream getInputStream() throws IOException {
        return context.getAssets().open(path, AssetManager.ACCESS_UNKNOWN);
    } 
 
    @Override 
    public String getClassName() {
        return path.substring(path.lastIndexOf("/"));
    } 
 
    @Override 
    public String toString() {
        return "AndroidResource (" + path + ")";
    } 
} 
7
CodeRank
This code example shows how to use the following methods:getAssets, getContentResolver
    private final PluginManager pluginManager;
    private boolean threadCheckingEnabled = true;
 
 
    public CordovaResourceApi(Context context, PluginManager pluginManager) {
        this.contentResolver = context.getContentResolver();
        this.assetManager = context.getAssets();
        this.pluginManager = pluginManager;
    } 
     
    public void setThreadCheckingEnabled(boolean value) {
        threadCheckingEnabled = value;
    } 
 
    public boolean isThreadCheckingEnabled() { 
        return threadCheckingEnabled;
    } 
     
    public static int getUriType(Uri uri) {
        assertNonRelative(uri);
6
CodeRank
This code example shows how to use the following methods:getAssets
 
public class AssetManagerProvider implements Provider<AssetManager> {
    @Inject protected Context context;
 
    public AssetManager get() {
        return context.getAssets();
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getAssets
typeface = Typeface.createFromFile(pAssetName);
			} 
			else 
			{ 
				typeface = Typeface.createFromAsset(pContext.getAssets(), pAssetName);
			} 
			Cocos2dxTypefaces.sTypefaceCache.put(pAssetName, typeface);
		} 
 
		return Cocos2dxTypefaces.sTypefaceCache.get(pAssetName);
	} 
 
	// =========================================================== 
	// Inner and Anonymous Classes 
	// =========================================================== 
 
} 
6
CodeRank
This code example shows how to use the following methods:getAssets
 
	public RobotoLightTextView(Context context, AttributeSet attrs) {
		super(context, attrs);
 
		if (!isInEditMode()) {
			mRobotoLightTypeface = Typeface.createFromAsset(context.getAssets(), "Roboto-Light.ttf");
			setTypeface(mRobotoLightTypeface);
		} 
	} 
 
} 
6
CodeRank
This code example shows how to use the following methods:getAssets
        init(context);
    } 
 
    private void init(Context context) {
        try { 
            Typeface tf = Typeface.createFromAsset(context.getAssets(), "Roboto-LightItalic.ttf");
            setTypeface(tf);
        } catch (RuntimeException e) {
            throw new RuntimeException("Make sure you copied the 'assets' folder from Silk to your own project; " + e.getMessage());
        } 
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getAssets
   * @return typeface, either cached or loaded from the assets 
   */ 
  public static Typeface getTypeface(final String name, final Context context) {
    Typeface typeface = TYPEFACES.get(name);
    if (typeface == null) {
      typeface = Typeface.createFromAsset(context.getAssets(), name);
      TYPEFACES.put(name, typeface);
    } 
    return typeface;
  } 
 
  /** 
   * Set typeface with name on given text view 
   * 
   * @param name 
   * @param view 
   * @return view 
   */ 
  public static <V extends TextView> V setTypeface(final String name,
      final V view) {
6
CodeRank
This code example shows how to use the following methods:getAssets
	private static Typeface mTypeface;
   private static final String FONT = "fonts/DroidSansArabic.ttf";
 
	public static Typeface getTypeface(Context context) {
      if (mTypeface == null){
         mTypeface = Typeface.createFromAsset(context.getAssets(), FONT);
      } 
		return mTypeface;
	} 
	public static String reshape(Context context, String text){
		ArabicReshaper rs = new ArabicReshaper();
		return rs.reshape(text);
	} 
} 
6
CodeRank

Related Context getAssets Questions & Answers:

getAssets Method Overview
Return an AssetManager instance for your application's package.
See Code Examples for other Android Context Methods: