I want to know how to get the views from a linked layout in preference activity.
<PreferenceCategory android:key="HEADER"
android:layout="@layout/prefernce_top_layout"
android:title="Application Settings" >
I want to get the views from "prefernce_top_layout.xml"... Currently I am doing this but unable to get View..
addPreferencesFromResource(R.layout.
userProfilePic = (ImageView)this.findViewById(R.id.profile_DP_settings);
Please Help! Thanks
Make a separate UI and load it like this in onCreat method:
addPreferencesFromResource(R.xml.preference);
setContentView(R.layout.prefernce_top_layout);
<RelativeLayout
android:id="@+id/headerLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/profile_DP_settings"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_margin="10dp"
android:src="@drawable/appicon"
android:visibility="gone" />
<TextView
android:id="@+id/fbUserName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/profile_DP_settings"
android:layout_toRightOf="@+id/profile_DP_settings"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:visibility="gone" />
</RelativeLayout>
<ListView
android:id="@android:id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/headerLayout" />