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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:42:33+00:00 2026-05-27T19:42:33+00:00

I have a custom listView with editText in each row to carry value entered

  • 0

I have a custom listView with editText in each row to carry value entered by the user.
and i have a button next to the listview which onclick will add up the editText value from all the rows from the list.

can anyone give me some link for some clue.

import android.app.Activity;
import android.app.ListFragment;
import android.content.PeriodicSync;
import android.os.Bundle;

import android.text.InputFilter.LengthFilter;
import android.util.Log;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

    public class NRSessionScheduleFragmentOne extends ListFragment {

        String[] dummyVal = new String[] { "hello", "how", "are", "u", "how",
                "are", "u", "how", "are" };
        ListView parentList;
        int addVal;
        EditText period;

        private NRSessionFragmentHolder parentobj;

        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
        }

        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                Bundle savedInstanceState) {

            View v = inflater.inflate(R.layout.nrtpsessiontopics, container, false);
            return v;
        }

        public void onActivityCreated(Bundle savedInstanceState) {
            super.onActivityCreated(savedInstanceState);
            setListAdapter(new MyListAdapter(getActivity()));
            parentList = (ListView) getActivity().findViewById(android.R.id.list);
            addVal = valueReturn(dummyVal, period, parentList);
        }

        public class MyListAdapter extends ArrayAdapter {
            Activity contextACT;

            public MyListAdapter(Activity context) {
                super(context, R.layout.nrrow_of_list_lesson, dummyVal);
                this.contextACT = context;
            }

            public View getView(final int position, View convertView,
                    ViewGroup parent) {
                LayoutInflater inflator = contextACT.getLayoutInflater();
                final View row = inflator.inflate(R.layout.nrrow_of_list_lesson,
                        null);
                final TextView name = (TextView) row.findViewById(R.id.lessonname);
                period = (EditText) row.findViewById(R.id.ssperiodeditText);
                final Button increase = (Button) row.findViewById(R.id.ssincrease);
                final Button decrease = (Button) row.findViewById(R.id.ssdecrease);
                increase.setId(position);
                decrease.setId((dummyVal.length) + position);

                final Integer currentQuant = Integer.parseInt(period.getText()
                        .toString());

                increase.setOnClickListener(new View.OnClickListener() {

                    public void onClick(View v) {

                        increase.getId();
                        Log.w("button value", "" + increase.getId());
                        if (currentQuant != 0) {
                            period.setText(new Integer(currentQuant + 1).toString());
                        }

                    }
                });

            decrease.setOnClickListener(new View.OnClickListener() {

                public void onClick(View v) {
                    // TODO Auto-generated method stub

                    Log.w("button value1", " " + decrease.getId());
                    decrease.getId();
                    if (currentQuant != 1) {
                        period.setText(new Integer(currentQuant - 1).toString());
                    }

                }
            });


            return (row);

        }

    }

    void setParent(NRSessionFragmentHolder parent) {
        this.parentobj = parent;
    }

    public int valueReturn(String[] dummyVal, EditText period2,
            ListView parentList) {
        Integer add = 0;
        for (int i = 0; i <= dummyVal.length; i++) {
            View temp = null;
            temp = parentList.getChildAt(i);
            while (!(temp == null)) {
                add = Integer.parseInt(period2.getText().toString());

            }
        }
        return add;
    }

}
  • 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-27T19:42:33+00:00Added an answer on May 27, 2026 at 7:42 pm

    You need your Button’s onClickListener() to get the adapter of the listView, convert it to a List and sum up the contents of the list.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a listview with custom rows and that extends SimpleAdapter. Each row consist
I have a custom listView with a textView, editText and a Button on a
I have a custom listview which display an image, textview and radio button. I
Basically, I have a custom ListView in which each item looks like: <LinearLayout> <Table>
I have a listview with 200 items. I use a custom view for each
I have a custom ListView that uses a custom ArrayAdapter (which basically just overrides
I currently have a custom listview with two rows of text in each item,
I have one custom ListView called AreasListView which I've included in the XML file.
I have one listview.which contain one image ,text and one button .i had creted
I have a custom listview row whose XML has one ImageView and three TextViews

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.