android - Create dynamic textview resource id to save the value in php server -


create dynamic id save value in php server. every time should create new textview id, value , save php mysql db. after clicking on addvip button , creating new textview value

personadd.setonclicklistener(new onclicklistener(){     @override     public void onclick(view arg0) {         layoutinflater layoutinflater =         (layoutinflater) getbasecontext().getsystemservice(context.layout_inflater_service);         final view addview = layoutinflater.inflate(r.layout.personrowdetail, null);         textview textout = (textview) addview.findviewbyid(r.id.textout);         textout.settext(peoplehighpostionname.gettext().tostring() + "," + peoplehightpostionpostion.gettext().tostring());         textout.setid(r.id.textout);         peoplehighpostionname.settext("");         peoplehightpostionpostion.settext("");         button buttonremove = (button) addview.findviewbyid(r.id.remove);         buttonremove.setonclicklistener(new onclicklistener() {             @override             public void onclick(view v) {                 ((linearlayout) addview.getparent()).removeview(addview);             }         });         containerperson.addview(addview);                 // http://topandroidphones1.blogspot.in/2013/05/add-and-remove-view-dynamically.html     } }); 

personrowdetail.xml:

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_margin="5dp">     <button         android:id="@+id/remove"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_alignparentright="true"         android:text="remove"         android:theme="@style/mybutton"/>         <textview             android:id="@+id/textout"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_alignparentleft="true"             android:layout_toleftof="@id/remove"             android:textsize="20dp"             /> </relativelayout> 

mainactivity.xml:

<edittext     android:id="@+id/vip"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:hint="vip participants"     android:layout_marginleft="30dp"     />     <button         android:id="@+id/vipadd"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="add"         android:theme="@style/mybutton"         android:layout_gravity="right|center"         android:layout_alignparentbottom="true"         android:layout_alignparentright="true"         android:layout_alignparentend="true"         />     </relativelayout>     <linearlayout         android:id="@+id/containervip"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:orientation="vertical">     </linearlayout>  </linearlayout> 


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -