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

  • Home
  • SEARCH
  • 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 9231749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:08:49+00:00 2026-06-18T06:08:49+00:00

I have problem with adding 2 numbers in list view. This is my row

  • 0

I have problem with adding 2 numbers in list view. This is my row with 2 text view (for each numer). textView2 ignore

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:text="0"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/textView3"
        android:gravity="center_horizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=" - "
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="0"
        android:textAppearance="?android:attr/textAppearanceMedium" />

</LinearLayout>

When user add number it will display in list view. That second number needs to be 11 – that number that user inserted. It’s all working but I dont know how to display that second number.

public class MainActivity extends Activity {
    ArrayAdapter<String> m_adapter;
    ArrayList<String> m_listItems = new ArrayList<String>();
    Button bt;
    EditText et;
    TextView tv;
    ListView lv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        // Inflate the menu; this adds items to the action bar if it is present.
                bt = (Button) findViewById(R.id.button1);
                et = (EditText) findViewById(R.id.editText1);
                tv = (TextView) findViewById(R.id.textView1);
                lv = (ListView) findViewById(R.id.lista);
                m_adapter = new ArrayAdapter<String>(this,R.layout.row, R.id.textView1);
                lv.setAdapter(m_adapter);
                //final String input = et.getText().toString();

                bt.setOnClickListener(new View.OnClickListener() {

                    public void onClick(View v) {

                        String input = et.getText().toString();
                        if(null!=input&&input.length()>0){     
                        String maxpunti = "11";
                        int a = Integer.parseInt(maxpunti);
                        int b = Integer.parseInt(input);
                        int c = a-b;
                        String input2 = String.valueOf(c);
                        m_adapter.add(input);
                        m_adapter.add(input2);
                        m_adapter.notifyDataSetChanged();


                      }
                    }
                });
    }
} 
  • 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-06-18T06:08:51+00:00Added an answer on June 18, 2026 at 6:08 am

    The default implementation of ArrayAdapter<String> binds a single Stringvalue to a a single textfield. Since you have several views for each listitem or “row” in your listview ( you need to implement/extend your own ArrayAdapter and override the getView method.
    Them you can set the values for any number of custom views that you may have in your list item layout.

    Look at a simple example and also it might be a good idea to look som docs on how listviews/adpters work in android since they are very central.

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

Sidebar

Related Questions

I have problem adding arraylist to list view, will explain about my problem here..
I have a problem with utf-8 encoding in primefaces 3. but with this (adding
I have a problem either adding to or traversing a linked list. The main
I have a problem adding ADO.Net Entity Data Model to my existing project, or
I have a problem adding entities to a collection. public void SaveNotificationUsergroups(int bookingobjectID, int[]
I have a problem with adding OPTIONS to SELECT tag dynamically. Here is my
I have a problem with adding filter for attribute, which exist not in all
I have a little problem with adding actions on UITabBarItems. I am not using
so I have a problem with dynamically adding items to menuStrip. I mean I
I have some problem with my .htaccess file. Here I am adding my problem.

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.