Android examples for User Interface:View Property
set View Not Selected
//package com.java2s; import android.app.Activity; import android.support.annotation.IdRes; import android.view.View; public class Main { public static void setNotSelected(Activity activity, @IdRes int viewId) { View view = findView(activity, viewId); view.setSelected(false);//from ww w. ja v a 2 s . com } public static <T extends View> T findView(View parent, @IdRes int viewId) { return (T) parent.findViewById(viewId); } public static <T extends View> T findView(Activity activity, @IdRes int viewId) { return (T) activity.findViewById(viewId); } public static void setSelected(Activity activity, @IdRes int viewId) { View view = findView(activity, viewId); view.setSelected(true); } }