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 7308053
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T23:30:17+00:00 2026-05-28T23:30:17+00:00

i have one List in which their are two textview and one EditView in

  • 0

i have one List in which their are two textview and one EditView in single row . I bind these textviews and editview at runtime and now i want to do some validation for edittext inside listview ,but my EditView ID is same for all the Rows, so how can i apply validations in that editview plz help me .

Thanks in advance and Sorry for my poor English

My Code is Here

try {
        json = new JSONObject(status);
        getArray_Meter_Reading = new JSONArray();
        getArray_Meter_Reading = json.getJSONArray("meterReadings");

        myList = new ArrayList<HashMap<String, String>>();
        for (int i = 0; i < getArray_Meter_Reading.length(); i++) {

            map = new HashMap<String, String>();

            String meter_Name = getArray_Meter_Reading.getJSONObject(i)
                    .getString("MeterName").toString();

            String previous_Meter_Reading = getArray_Meter_Reading
                    .getJSONObject(i).getString("PrevMeterReading")
                    .toString();

            map.put("meterName", meter_Name);
            map.put("previousMeterReading", previous_Meter_Reading);

            myList.add(map);

        }

    } catch (JSONException e) {

        e.printStackTrace();
    }

    SimpleAdapter myAdapter = new SimpleAdapter(this, myList,
            R.layout.meter_reading_list, new String[] {
                    "meterName", "previousMeterReading" }, new int[] { R.id.txt_Meter_Name,
                    R.id.txt_Previous});

    lst.setAdapter(myAdapter);

    lst.setOnTouchListener(new View.OnTouchListener() {

        public boolean onTouch(View v, MotionEvent event) {
            if(event.getAction() == MotionEvent.ACTION_MOVE){
                lst.scrollBy(0, 1);
            }
            return false;
        }
    });

And my Xml layout which im buinding with this listview

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingBottom="6dip"
android:paddingTop="4dip" >

<TextView
    android:id="@+id/txt_Meter_Name"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:width="140dp" />

<TextView
    android:id="@+id/txt_Previous"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:width="100dp" />

<EditText
    android:id="@+id/ed_Current"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:imeOptions="actionNext|actionDone"
    android:singleLine="true"
    android:width="100dp" >
</EditText>

  • 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-28T23:30:18+00:00Added an answer on May 28, 2026 at 11:30 pm
    You have two way for this.
    1. Using Custom Adapter
    2.As you are doing..but when you are selecting position then you need to get view id like 
    
    lst.setOnTouchListener(new View.OnTouchListener() {
    
        public boolean onTouch(View v, MotionEvent event) {
            if(event.getAction() == MotionEvent.ACTION_MOVE){
                lst.scrollBy(0, 1);
            }
            return false;
        }
    });
    
    You should take operation on View v.This view will give you differnt id as it have.
    I will suggest you to use custom adapter if not resolved this way as you are doing.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one std::list<> container and these threads: One writer thread which adds elements
I have written a simple CRUD form which has one select list. However the
I have a list view control which at the moment only allows one item
I have a list of e-mails from one database which I want to check
I have two tables, one is a list of songs. The other is a
I have two tables. T1 has one column which has 9000 unique records (varchar).
We have used Custom List View inside that one Text View and two Edit
I have a list of two-dimensional points and I want to obtain which of
I have the following two functions which take two dictionaries and recursively add their
I want to have two columns in webpage and each one with their own

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.