i want to Call Android Layout(XML) Programmatically in a function. Layout is already Created in XML. i am asking this question because i don't want to use this in Android Native app, actually i will call these layouts in Unity3D which is a Gaming Engine. So Let say that i have a layout. For Example look at below code:
<LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:orientation="vertical"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/useful_nums_item_name"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/useful_nums_item_value"/> </LinearLayout> <ImageButton android:layout_width="0dp" android:layout_height="wrap_content" android:src="@drawable/call" android:id="@+id/call_btn" android:onClick="callNumber"/> </LinearLayout>
Now i want to create a function which can call this layout. But But i don't want to use below code as i am not going to use in Android Native App.
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
i will directly use the Unity3D class as below:
public class MainActivity extends UnityPlayerActivity {
}
So i need to call my layout in that class but in form of Some Function. For Example:
public class MainActivity extends UnityPlayerActivity {
public void ShowLayout(){
enter code here
}
}
So i need you people help to solve this problem.
Any help will be appreciated.