InternalAccessor

Created by Anggrayudi on 11/03/2016.

A utility class that provides access to all resources in com.android.internal.R class. This class does not use Java reflection anymore, and certainly safe.

class InternalAccessor

Types

Builder
Link copied to clipboard

since we don't use Context and Java reflection to get the internal resources, so using this Builder is redundant. Get them directly without storing to this class or

open class Builder

Functions

getAnimation
Link copied to clipboard

Pick Animation resources from com.android.internal.R.anim

open fun getAnimation(resName: String): XmlResourceParser
getBoolean
Link copied to clipboard

Pick boolean resources from com.android.internal.R.bool

open fun getBoolean(resName: String): Boolean
getColor
Link copied to clipboard

Pick color resources from com.android.internal.R.color

open fun getColor(resName: String): Int
getDimension
Link copied to clipboard

Pick dimension resources from com.android.internal.R.dimen

open fun getDimension(resName: String): Float
getDrawable
Link copied to clipboard

Pick Drawable resources from com.android.internal.R.drawable

open fun getDrawable(resName: String): Drawable
open fun getDrawable(resName: String, theme: Resources.Theme): Drawable
getFraction
Link copied to clipboard

Pick fractional unit resources from com.android.internal.R.fraction

open fun getFraction(resName: String, base: Int, pbase: Int): Float
getIntArray
Link copied to clipboard

Pick Integer array resources from com.android.internal.R.array

open fun getIntArray(resName: String): Array<Int>
getInteger
Link copied to clipboard

Pick Integer resources from com.android.internal.R.integer

open fun getInteger(resName: String): Int
getLayout
Link copied to clipboard

Pick layout resources from com.android.internal.R.layout

open fun getLayout(resName: String): XmlResourceParser
getMenu
Link copied to clipboard

Pick menu resources from com.android.internal.R.menu

open fun getMenu(resName: String): XmlResourceParser
getMipmap
Link copied to clipboard

Pick mipmap drawable resources from com.android.internal.R.mipmap

open fun getMipmap(resName: String): Drawable
open fun getMipmap(resName: String, theme: Resources.Theme): Drawable
getRaw
Link copied to clipboard

Pick RAW resources from com.android.internal.R.raw

open fun getRaw(resName: String): InputStream
getResourceId
Link copied to clipboard

Pick resource id from com.android.internal.R

open fun getResourceId(clas: String, resName: String): Int
getString
Link copied to clipboard

Pick string resources from com.android.internal.R.string

open fun getString(resName: String): String
getStringArray
Link copied to clipboard

Pick String array resources from com.android.internal.R.array

open fun getStringArray(resName: String): Array<String>
getXml
Link copied to clipboard

Pick XML resources from com.android.internal.R.xml

open fun getXml(resName: String): XmlResourceParser
isClassExists
Link copied to clipboard

Check whether a class exists, and do your action when it's return true.

open fun isClassExists(className: String): Boolean
isMethodExists
Link copied to clipboard

Check whether a method exists without checking its parameter types. This is similar with

open fun isMethodExists(className: String, methodName: String): Boolean

Check whether a method exists within its class. An example for this method is:

boolean methodExists = InternalAccessor.isMethodExists("android.content.Intent", "putExtra", String.class, Integer.class);
if (methodExists)
{
    ...
}
where putExtra() has two types of parameter, i.e. String and Integer. If you look at the source code, you'll see that the real method is: putExtra(String name, int value).

See isMethodExists

open fun isMethodExists(className: String, methodName: String, parameterTypes: Array<Class<Out Any>>): Boolean

Properties

ANIM
Link copied to clipboard
val ANIM: String
ARRAY
Link copied to clipboard
val ARRAY: String
ATTR
Link copied to clipboard
val ATTR: String
BOOL
Link copied to clipboard
val BOOL: String
COLOR
Link copied to clipboard
val COLOR: String
DIMEN
Link copied to clipboard
val DIMEN: String
DRAWABLE
Link copied to clipboard
val DRAWABLE: String
FRACTION
Link copied to clipboard
val FRACTION: String
ID
Link copied to clipboard
val ID: String
INTEGER
Link copied to clipboard
val INTEGER: String
INTERPOLATOR
Link copied to clipboard
val INTERPOLATOR: String
LAYOUT
Link copied to clipboard
val LAYOUT: String
MENU
Link copied to clipboard
val MENU: String
MIPMAP
Link copied to clipboard
val MIPMAP: String
PLURALS
Link copied to clipboard
val PLURALS: String
RAW
Link copied to clipboard
val RAW: String
STRING
Link copied to clipboard
val STRING: String
STYLE
Link copied to clipboard
val STYLE: String
STYLEABLE
Link copied to clipboard
val STYLEABLE: String
TRANSITION
Link copied to clipboard
val TRANSITION: String
XML
Link copied to clipboard
val XML: String