Available Methods
- getSystemService ( )
- obtainStyledAttributes ( )
- startActivity ( )
- getSharedPreferences ( )
- getApplicationContext ( )
- getString ( )
- getResources ( )
- getPackageManager ( )
- startService ( )
- getPackageName ( )
- getContentResolver ( )
- sendBroadcast ( )
- getCacheDir ( )
- getFilesDir ( )
- getApplicationInfo ( )
- toString ( )
- registerReceiver ( )
- getAssets ( )
- getExternalFilesDir ( )
- getExternalCacheDir ( )
- getDir ( )
- unregisterReceiver ( )
- bindService ( )
- openFileOutput ( )
- stopService ( )
- checkCallingOrSelfPermission ( )
- getTheme ( )
- unbindService ( )
- startForegroundService ( )
- getMainLooper ( )
- deleteDatabase ( )
- getClassLoader ( )
- getDatabasePath ( )
- openFileInput ( )
- MODE_PRIVATE
- checkSelfPermission ( )
- getDrawable ( )
- checkPermission ( )
- deleteFile ( )
- createConfigurationContext ( )
- getColor ( )
- grantUriPermission ( )
- CONTEXT_DEVICE_PROTECTED_STORAGE
- getExternalFilesDirs ( )
- getFileStreamPath ( )
- CONTEXT_CREDENTIAL_PROTECTED_STORAGE
- sendOrderedBroadcast ( )
- setTheme ( )
- MODE_MULTI_PROCESS
- checkCallingOrSelfUriPermission ( )
- getText ( )
- createPackageContext ( )
- openOrCreateDatabase ( )
- isRestricted ( )
- NOTIFICATION_SERVICE
- BIND_AUTO_CREATE
- startActivities ( )
- getPackageCodePath ( )
- createDeviceProtectedStorageContext ( )
- getExternalCacheDirs ( )
- CONTEXT_IGNORE_SECURITY
- registerComponentCallbacks ( )
- revokeUriPermission ( )
- getColorStateList ( )
- CONTEXT_RESTRICTED
- checkCallingPermission ( )
- BIND_IMPORTANT
- deleteSharedPreferences ( )
- getClass ( )
- getCodeCacheDir ( )
- BIND_DEBUG_UNBIND
- MODE_WORLD_READABLE
- startServiceAsUser ( )
- getSharedPreferencesPath ( )
- enforceCallingOrSelfPermission ( )
- BIND_TREAT_LIKE_ACTIVITY
- getObbDir ( )
- getObbDirs ( )
- LOCATION_SERVICE
- moveSharedPreferencesFrom ( )
- CONTEXT_INCLUDE_CODE
- bindServiceAsUser ( )
- BIND_ABOVE_CLIENT
- removeStickyBroadcast ( )
Related Classes
- java.io.File
- java.io.InputStream
- android.os.Bundle
- android.view.View
- java.util.Date
- android.util.Log
- android.widget.TextView
- android.content.Intent
- android.view.ViewGroup
- android.app.Activity
- java.io.FileOutputStream
- java.util.Locale
- android.view.LayoutInflater
- android.os.Build
- android.widget.Toast
- android.util.AttributeSet
- android.widget.ImageView
- android.graphics.Color
- android.os.Handler
- android.net.Uri
- android.graphics.Bitmap
- android.text.TextUtils
- android.graphics.Paint
- android.graphics.drawable.Drawable
- android.widget.LinearLayout
Java Code Examples for android.content.Context#getColorStateList()
The following examples show how to use
android.content.Context#getColorStateList() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SuggestionsAdapter.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
private CharSequence formatUrl(Context context, CharSequence url) { if (mUrlColor == null) { // Lazily get the URL color from the current theme. TypedValue colorValue = new TypedValue(); context.getTheme().resolveAttribute(R.attr.textColorSearchUrl, colorValue, true); mUrlColor = context.getColorStateList(colorValue.resourceId); } SpannableString text = new SpannableString(url); text.setSpan(new TextAppearanceSpan(null, 0, 0, mUrlColor, null), 0, url.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); return text; }
Example 2
Source File: ThemeHelper.java From NewsMe with Apache License 2.0 | 5 votes |
public static ColorStateList getActionTextColorStateList(Context context, @ColorRes int colorId) { final TypedValue value = new TypedValue(); context.getResources().getValue(colorId, value, true); if (value.type >= TypedValue.TYPE_FIRST_COLOR_INT && value.type <= TypedValue.TYPE_LAST_COLOR_INT) { return getActionTextStateList(context, value.data); } else { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) { //noinspection deprecation return context.getResources().getColorStateList(colorId); } else { return context.getColorStateList(colorId); } } }
Example 3
Source File: ThemeHelper.java From AndroidTint with Apache License 2.0 | 5 votes |
public static ColorStateList getActionTextColorStateList(Context context, @ColorRes int colorId) { final TypedValue value = new TypedValue(); context.getResources().getValue(colorId, value, true); if (value.type >= TypedValue.TYPE_FIRST_COLOR_INT && value.type <= TypedValue.TYPE_LAST_COLOR_INT) { return getActionTextStateList(context, value.data); } else { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) { //noinspection deprecation return context.getResources().getColorStateList(colorId); } else { return context.getColorStateList(colorId); } } }
Example 4
Source File: Resource.java From proteus with Apache License 2.0 | 5 votes |
@Nullable public static ColorStateList getColorStateList(int resId, Context context) { try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { return context.getColorStateList(resId); } else { //noinspection deprecation return context.getResources().getColorStateList(resId); } } catch (Resources.NotFoundException nfe) { return null; } }