Hi All, I have LinearLayout. Inside to that i have added one more Linearyout ( checkbox & text ).
(LinearLayout) one textView, (LinearLayout) Checkbox,textview , one textview Now whenever clicks the checkbox, i need to dynamically display EditBox after the checkbox. main.xml --------------- <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:orientation="horizontal" android:id="@+id/MainLayout" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="25sp" android:text="Enter category :" /> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:id="@+id/locationLayout"> <CheckBox android:id="@+id/checkbox" android:layout_width="40dp" android:layout_height="40dp" android:checked="true"/> <TextView android:id="@+id/checkboxtext" android:layout_width="fill_parent" android:layout_height="40dp" android:paddingLeft="20dp" android:layout_gravity="center_horizontal" android:layout_centerHorizontal="true" android:textSize="25sp" android:text="Current Location" /> </LinearLayout> <TextView android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="25sp" android:text="End of category :" /> </LinearLayout> test.xml: ------------- <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <EditText android:id="@+id/categotytextbox" android:hint="eg. pubs,restuarants " android:layout_width="250dip" android:layout_height="wrap_content" android:maxLines="1"/> </LinearLayout> On the click of checkbox listener i added a code like below. public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main1); final CheckBox location = (CheckBox)findViewById(R.id.checkbox); location.setOnClickListener(new Button.OnClickListener(){ public void onClick(View v) { if(location.isChecked() == true) { LinearLayout l = (LinearLayout) findViewById(R.id.locationLayout); LayoutInflater linflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View myView = linflater.inflate(R.layout.main, null); l.addView(myView); } else { LinearLayout l = (LinearLayout) findViewById(R.id.locationLayout); LayoutInflater linflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View myView = linflater.inflate(R.layout.main, null); l.removeView(myView); // I want to the layout which was added earlier. How do i do that.? I know this is not correct solution. } } }); Can anyone help me here.? Thanks, - mani -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

