Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7027683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T00:16:50+00:00 2026-05-28T00:16:50+00:00

I have an xml with one textveiw and one edittext in it .I used

  • 0

I have an xml with one textveiw and one edittext in it .I used this xml to get different rows in the list view of another xml file to list the data in that page.

The xml file that is used to list data in listview is as given below

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="2dip"
    android:paddingBottom="0dip">

    <TextView 
    android:id="@+id/tv_Sort_Address"
    android:layout_width="0dip"
    style="@style/ListTextViewStyle"
    android:layout_height="wrap_content"
    android:text="No"
     android:layout_weight="2"/>

    <EditText 
    android:textColor="#000000" 
    android:layout_height="wrap_content" 
   android:layout_width="0dip"
    android:inputType="number" 
    style="@style/EditTextStyle"
    android:background="@android:drawable/editbox_background" 
    android:id="@+id/et_Sort_Order"
     android:layout_weight="1">

    </EditText>


      </LinearLayout>

I filled the Listview with data on another xml fils as given below

simpleAdapter = new SimpleAdapter(this, alist,
                R.layout.sort_order_list_row, new String[] { "Sort_Address",
                        "Sort_FKDeliveryStatus", "Sort_PKDelivery",
                        "Sort_DeliveryOrder" }, new int[] {
                        R.id.tv_Sort_Address, R.id.tv_Sort_FKDeliveryStatus,
                        R.id.tv_Sort_PKDelivery, R.id.et_Sort_Order });
        listSortOrder.setAdapter(simpleAdapter);

The problem with me is that if i have two row in the listview and when i
placed a value in one of edit text row and move on to the another rows edit text the value placed in the first row got disappered.

 <ListView android:id="@+id/lv_Sort_Order"
       style="@style/ListTextBackGround"
     android:layout_width="match_parent"  
     android:layout_height="match_parent"
     android:layout_weight="1" 
     android:layout_marginLeft="5dip"      
     android:descendantFocusability="afterDescendants"     
     android:layout_marginRight="5dip" >
     </ListView>

to solve this I placed android:descendantFocusability="afterDescendants" in the list view page to get focus on to the merged page. But it didn’t solve the problem. Will anyone help me please.

Is there any property I need to be placed in the list view or in the merged Page?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T00:16:51+00:00Added an answer on May 28, 2026 at 12:16 am
    Use this code :   
    
    public class ListViewDemo extends Activity {
    
        private ListView listViewScore = null;
        private ListViewAdapter listViewAdapter = null;
        private String[] usernameArr = null;
        private String[] scoreArr = null;
        //ArrayList<String>  usernameArrLst = null ,scoreArrLst = null;
        //private Helper helper = null;
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            listViewScore=(ListView)findViewById(R.id.listViewScore);
    
            usernameArr = new String[]{"Alan","Bob","Carl","Doaniel","Evan","Fred","Gram"};
            scoreArr = new String[usernameArr.length];
    
            //usernameArrLst = new ArrayList<String>(Arrays.asList(usernameArr));
            //scoreArrLst = new ArrayList<String>(Arrays.asList(scoreArr));
    
            listViewAdapter = new ListViewAdapter();
            listViewScore.setAdapter(listViewAdapter);
        }
    
        class ListViewAdapter extends BaseAdapter{
    
            @Override
            public int getCount() {
                // TODO Auto-generated method stub
                if(usernameArr==null){
                    return 0;
                }
    
                return usernameArr.length;
            }
    
            @Override
            public Object getItem(int position) {
                // TODO Auto-generated method stub
                return usernameArr[position];
            }
    
            @Override
            public long getItemId(int position) {
                // TODO Auto-generated method stub
                return position;
            }
    
            @Override
            public View getView(int position, View view, ViewGroup parent) {
                // TODO Auto-generated method stub
                final ViewHolder viewHolder ;
                View rowView=view;
    
                if(rowView==null){
                    LayoutInflater layoutinflate =LayoutInflater.from(ListViewDemo.this);
                    rowView=layoutinflate.inflate(R.layout.listviewnewtext, parent, false);
    
                    viewHolder = new ViewHolder();
    
                    viewHolder.tv_Sort_Address = (TextView)rowView.findViewById(R.id.tv_Sort_Address);
                    viewHolder.et_Sort_Order = (EditText)rowView.findViewById(R.id.et_Sort_Order);
    
                    viewHolder.et_Sort_Order.addTextChangedListener(new TextWatcher() {
    
                        @Override
                        public void onTextChanged(CharSequence s, int start, int before, int count) {
                            // TODO Auto-generated method stub
                        }
    
                        @Override
                        public void beforeTextChanged(CharSequence s, int start, int count,
                                int after) {
                            // TODO Auto-generated method stub
                        }
    
                        @Override
                        public void afterTextChanged(Editable s) {
                            // TODO Auto-generated method stub
                            scoreArr[viewHolder.ref] = s.toString();
    
                        }
                    });
    
                    rowView.setTag(viewHolder);
                }else{
                    viewHolder = (ViewHolder) rowView.getTag();
                }
    
                viewHolder.ref = position;
    
                viewHolder.tv_Sort_Address.setText(usernameArr[position]);
                viewHolder.et_Sort_Order.setText(scoreArr[position]);
    
                return rowView;
            }
    
        }//class ends
    
        class ViewHolder{
            TextView tv_Sort_Address;
            EditText et_Sort_Order;
            int ref;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xml file like this: <root> <item> <name>one</name> <status>good</status> </item> <item> <name>two</name>
Let's suppose I have xml like this one: <Server Active=No> <Url>http://some.url</Url> </Server> C# class
I have a .xslt that translates xml from one form to another (I'm not
I have an XML file which has many section like the one below: <Operations>
i have an xml file sitemap.xml as shown below ..i need to add one
I have an XML file that I'm trying to parse with Linq-to-XML. One of
I am new to MVC and facing one issue. I have a xml file
Let's say I have two strings: one is XML data and the other is
If I have one layout file => res/layout/item.xml : <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
I have defined a layer-list with a couple of items on an xml file.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.