Resources getText - top ranked examples from Open Source projects

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

This code example shows how to use the following methods:getText
     * this resource is loaded from <var>res</var> and returned.  Otherwise 
     * {@link #title} is returned. 
     */ 
    public CharSequence getTitle(Resources res) {
        if (titleRes != 0) {
            return res.getText(titleRes);
        } 
        return title;
    } 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getText
     * this resource is loaded from <var>res</var> and returned.  Otherwise 
     * {@link #title} is returned. 
     */ 
    public CharSequence getTitle(Resources res) {
        if (titleRes != 0) {
            return res.getText(titleRes);
        } 
        return title;
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getDrawable, getText
    public void addItem(Drawable drawable, int resid, OnClickListener l) {
        addItem(drawable, resources.getString(resid), l);
    } 
 
    public void addItem(int drawable, int resid, OnClickListener l) {
        addItem(resources.getDrawable(drawable), resources.getText(resid).toString(), l);
    } 
 
    public boolean onKeyUp(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            onBackPressed(); 
            return true; 
        } 
 
        return false; 
    } 
 
    private void onBackPressed() { 
        dismiss();
    } 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getText
  public static String sFileName;
 
  public static String getFileName(Context context) {
    if (sFileName == null) {
      Resources resources = context.getResources();
      String name = resources.getText(ID).toString();
      sFileName = name.substring(name.lastIndexOf('/') + 1, name.length());
    } 
    return sFileName;
  } 
 
  public static String getFileExtension(Context context) {
    if (sFileName == null) {
      getFileName(context);
    } 
    int dotIndex = sFileName.lastIndexOf('.');
    if (dotIndex == -1) {
      return null; 
    } 
    return sFileName.substring(dotIndex);
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getText
  public static String sFileName;
 
  public static String getFileName(Context context) {
    if (sFileName == null) {
      Resources resources = context.getResources();
      String name = resources.getText(ID).toString();
      sFileName = name.substring(name.lastIndexOf('/') + 1, name.length());
    } 
    return sFileName;
  } 
 
  public static String getFileExtension(Context context) {
    if (sFileName == null) {
      getFileName(context);
    } 
    int dotIndex = sFileName.lastIndexOf('.');
    if (dotIndex == -1) {
      return null; 
    } 
    return sFileName.substring(dotIndex);
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getText
    } 
 
    @Override 
    public CharSequence getText(int id) throws NotFoundException {
        try { 
            return mExtend.getText(id);
        } catch (NotFoundException e) {
            return super.getText(id);
        } 
    } 
 
    @Override 
    public Drawable getDrawable(int id) throws NotFoundException {
        try { 
            return mExtend.getDrawable(id);
        } catch (NotFoundException e) {
            return super.getDrawable(id);
        } 
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getText
    return base.getText(id, def);
  } 
 
  @Override 
  public CharSequence getText(int id) throws NotFoundException {
    return base.getText(id);
  } 
 
  @Override 
  public CharSequence[] getTextArray(int id) throws NotFoundException {
    return base.getTextArray(id);
  } 
 
  @Override 
  public void getValue(int id, TypedValue outValue, boolean resolveRefs)
      throws NotFoundException { 
    base.getValue(id, outValue, resolveRefs);
  } 
 
  @Override 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getText
            return mRes.getString(id, formatArgs);
        } 
 
        @Override 
        public CharSequence getText(int id) throws NotFoundException {
            return mRes.getText(id);
        } 
    } 
 
    private static String sCallingPackage = null;
 
    void ensureCallingPackage() { 
        sCallingPackage = this.packageName;
    } 
 
    /** 
     * Mock {@link PackageManager} that knows about a specific set of packages 
     * to help test security models. Because {@link Binder#getCallingUid()} 
     * can't be mocked, you'll have to find your mock-UID manually using your 
     * {@link Context#getPackageName()}. 
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getText
    verifyAll(); 
  } 
 
  @SmallTest 
  public void testGetText1() { 
    expect(base.getText(10, "abcde")).andReturn("abcdefg");
    replayAll(); 
 
    assertEquals("abcdefg", resources.getText(10, "abcde"));
 
    verifyAll(); 
  } 
 
  @SmallTest 
  public void testGetText2() { 
    expect(base.getText(10)).andReturn("abcde");
    replayAll(); 
 
    assertEquals("abcde", resources.getText(10));
 
4
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Resources getText Questions & Answers:

getText Method Overview
Return the string value associated with a particular resource ID.
See Code Examples for other Android Resources Methods: