I have a view being created based on a boolean option, the view is titled socialoptions which is defined in a separate xml file. The view returns null anytime I am trying to use it through methods such as socialoptions.setClickable(true);
.
Java Code:
if (isUserProfile) {
Log.d("user","user");
middlelayout = (LinearLayout) findViewById (R.layout.usermiddlelayout);
} else {
Log.d("item","item");
middlelayout = (LinearLayout) findViewById (R.layout.itemmiddlelayout);
socialoptions = (TextView) findViewById (R.id.socialoptions);
map = (TextView) findViewById (R.id.map);
}
XML CODE:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/itemmiddlelayout"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="25"
android:background="@android:color/transparent"
android:clickable="false"
android:orientation="horizontal" >
<RelativeLayout
android:id="@+id/sociallayout"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="2"
android:background="@android:color/transparent"
android:paddingBottom="0dp"
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:id="@+id/socialoptions"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/transparent"
android:clickable="false" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/maplayout"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@android:color/transparent"
android:paddingBottom="10dp"
android:paddingTop="0dp" >
<TextView
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/transparent"
android:clickable="false" />
</RelativeLayout>
</LinearLayout>