Code example for TypedValue

Methods: resolveAttribute

		webView.loadUrl(String.format("data:text/html;charset=utf-8,%s", Uri.encode(html)));
    public static boolean isDarkTheme(Context context) {
        TypedValue tv = new TypedValue();
        float [] hsv =  new float[3];
        context.getTheme().resolveAttribute(android.R.attr.textColorPrimary, tv, true);
        Color.colorToHSV(context.getResources().getColor(tv.resourceId), hsv);
        return hsv[2] > 0.5f;
	public static String getQuantityString(View view, int id, int count) {
		return String.format("%,d %s", count, view.getContext().getResources().getQuantityString(id, count));
	public static void displayInstantAnswer(View view, BaseModel model) {
		TextView title = (TextView) view.findViewById(;
		TextView detail = (TextView) view.findViewById(;
Connect your IDE to all the code out there  Get Codota for Java