Hi,
Can you share your code. i have similar issue. i want to save all
infromation in mysql
On Wednesday, 21 September 2011 16:14:14 UTC+5:30, aparna rani wrote:
>
> hii
>
> i am implement listview and each view having editlist box.
> problem when i trying to get data from all editboxes its takes only first
> screen view.
> here show only 5 views. when scrolling g=i get the problem.
> please help me?
>
> her my code is
> [image: image.png]
> //java class
>
> *package com.codemobiles.android.demo.customlistview;*
>
> *import java.util.ArrayList;*
> *import java.util.List;*
>
> *import android.app.ListActivity;*
> *import android.content.Context;*
> *import android.os.Bundle;*
> *import android.util.Log;*
> *import android.view.LayoutInflater;*
> *import android.view.View;*
> *import android.view.View.OnClickListener;*
> *import android.view.ViewGroup;*
> *import android.view.Window;*
> *import android.widget.BaseAdapter;*
> *import android.widget.Button;*
> *import android.widget.EditText;*
> *import android.widget.Filter;*
> *import android.widget.Filterable;*
> *import android.widget.ListView;*
> *import android.widget.TextView;*
> *import android.widget.Toast;*
> *import android.widget.ViewFlipper;*
>
> *public class CustomListViewDemo extends ListActivity implements
> OnClickListener*
> *{*
> * private Button ok_button;*
> * private Button cancel_button;*
> * private EfficientAdapter adap;*
> * ViewFlipper flipper;*
> * private static String[] data = new String[] { "0", "1", "2", "3", "4" };*
> * private static String[] TitleString= new String[]{"[email protected]
> <javascript:>","[email protected] <javascript:>","[email protected]
> <javascript:>","pakaims.edu.pk <http://pakaims.edu.pk>","[email protected]
> <javascript:>"};*
> * private static String[] DetailString= new String[]{"umar
> shafique","Abdul karim","Poker de king maker","PakAims","test"};*
> * private static List<EditText> editTextList = new ArrayList<EditText>();*
> * @Override*
> * public void onCreate(Bundle savedInstanceState) *
> * {*
> * super.onCreate(savedInstanceState);*
> * requestWindowFeature(Window.FEATURE_NO_TITLE);*
> * setContentView(R.layout.list);*
> * ok_button=(Button)findViewById(R.id.select_ok_button);*
> * cancel_button=(Button)findViewById(R.id.select_cancel_button);*
> * adap = new EfficientAdapter(this);*
> * setListAdapter(adap);*
> * hookupButton();*
> * }*
> * public void hookupButton()*
> * {*
> * ok_button.setOnClickListener(new Button.OnClickListener() *
> * {*
> * @Override*
> * public void onClick(View view)*
> * {*
> * for(int i=0;i<editTextList.size();i++)*
> * {*
> * String q=editTextList.get(i).getText().toString();*
> * Log.v(" indela","indela");*
> * }*
> * }*
> * });*
> * cancel_button.setOnClickListener(new Button.OnClickListener() *
> * {*
> * @Override*
> * public void onClick(View view)*
> * {*
>
> * }*
>
> * });*
> * }*
> * @Override*
> * protected void onListItemClick(ListView l, View v, int position, long
> id) *
> * {*
> * super.onListItemClick(l, v, position, id);*
> * Toast.makeText(this, "Click-" + String.valueOf(position),
> Toast.LENGTH_SHORT).show();*
> * }*
>
> * public static class EfficientAdapter extends BaseAdapter implements
> Filterable *
> * {*
> * private LayoutInflater mInflater;*
> * private Context context;*
> * //public List<String> myItems = new ArrayList();*
> * public EfficientAdapter(Context context) *
> * {*
> * mInflater = LayoutInflater.from(context);*
> * this.context = context;*
> * }*
> * @Override*
> * public View getView(final int position, View convertView, ViewGroup
> parent) *
> * {*
> * ViewHolder holder;*
> * if (convertView == null) *
> * {*
> * convertView = mInflater.inflate(R.layout.adaptor_content, null);*
> * holder = new ViewHolder();*
> * holder.textLine = (TextView) convertView.findViewById(R.id.textLine);*
> * holder.textLine2 =(TextView) convertView.findViewById(R.id.textLine2);*
> * holder.Edittext = (EditText)
> convertView.findViewById(R.id.edittext_qty);*
> * editTextList.add(holder.Edittext);*
> * convertView.setOnClickListener(new OnClickListener() *
> * {*
> * private int pos = position;*
> * @Override*
> * public void onClick(View v) *
> * {*
> * Toast.makeText(context, "Click-" + String.valueOf(pos),
> Toast.LENGTH_SHORT).show(); *
> * }*
> * });*
> * convertView.setTag(holder);*
> * } *
> * else *
> * {*
> * holder = (ViewHolder) convertView.getTag();*
> * }*
> * holder.textLine.setText(TitleString[position] +
> String.valueOf(position));*
> * holder.textLine2.setText(DetailString[position] +
> String.valueOf(position));*
> * return convertView;*
> * }*
>
> * static class ViewHolder *
> * {*
> * TextView textLine;*
> * TextView textLine2;*
> * EditText Edittext;*
>
> * }*
>
> * @Override*
> * public Filter getFilter() *
> * {*
> * return null;*
> * }*
>
> * @Override*
> * public long getItemId(int position) *
> * {*
> * return 0;*
> * }*
>
> * @Override*
> * public int getCount() *
> * {*
> * return data.length;*
> * }*
>
> * @Override*
> * public Object getItem(int position) *
> * {*
> * return data[position];*
> * }*
> * }*
>
> * @Override*
> * public void onClick(View v) {*
> * // TODO Auto-generated method stub*
> * }*
> *}*
>
>
> //list.xml file
>
> <?xml version="1.0" encoding="utf-8"?>
>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
> android:orientation="vertical"
> android:layout_height="fill_parent"
> android:layout_width="fill_parent">
> <ListView android:id="@+id/android:list"
> android:layout_width="fill_parent"
> android:layout_height="fill_parent"
> android:layout_weight="1"/>
> <LinearLayout android:layout_width="fill_parent"
> android:layout_height="wrap_content"
> android:layout_weight="0"
> android:orientation="horizontal"
> android:gravity="center"
> android:padding="4dip"
> android:weightSum="1"
> android:background="@color/help_button_view">
> <Button android:id="@+id/select_ok_button"
> android:layout_width="0dip"
> android:layout_height="wrap_content"
> android:layout_weight="0.5"
> android:text="Ok"/>
> <Button android:id="@+id/select_cancel_button"
> android:layout_width="0dip"
> android:layout_height="wrap_content"
> android:layout_weight="0.5"
> android:text="Cancel"/>
> </LinearLayout>
> </LinearLayout>
>
> //adaptor_content.xml file
>
> <?xml version="1.0" encoding="utf-8"?>
> <RelativeLayout android:id="@+id/lineItem"
> xmlns:android="http://schemas.android.com/apk/res/android"
> android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:gravity="center_vertical">
> <TextView android:id="@+id/textLine"
> android:layout_height="wrap_content"
> android:layout_marginLeft="10dip"
> android:textSize="15sp"
> android:layout_width="wrap_content"/>
> <TextView android:id="@+id/textLine2"
> android:layout_height="wrap_content"
> android:layout_marginLeft="10dip"
> android:textSize="10sp"
> android:layout_width="wrap_content"
> android:layout_below="@+id/textLine" />
> <LinearLayout android:layout_width="wrap_content"
> android:layout_height="wrap_content"
> android:orientation="horizontal"
> android:layout_alignParentRight="true">
> <EditText android:id="@+id/edittext_qty"
> android:gravity="center"
> android:layout_height="wrap_content"
> android:layout_width="wrap_content"
> android:singleLine="true"
> android:hint="qty"/>
> </LinearLayout>
> </RelativeLayout>
>
>
--
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit
https://groups.google.com/d/msgid/android-developers/2d292e1c-0a44-40be-a767-102960a76a88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.