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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T19:09:31+00:00 2026-05-31T19:09:31+00:00

My main.xml has 2 edit text for the user to insert values. And my

  • 0

My main.xml has 2 edit text for the user to insert values. And my custom_list_item.xml has a text view and an edit text. The input of the user would be inserted into the text view and edit text respectively.

However, currently I am only able to pass 1 value into the adapter. How can I pass the other value over to the adapter?

main.java

public class main extends Activity{

ArrayList<String> noteList = new ArrayList<String>();
FancyAdapter aa = null;

Button calculate;
EditText result;
String total;
String name;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    final Spinner spinner = (Spinner)findViewById(R.id.spinner);
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
            this, R.array.spinner_array, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinner.setAdapter(adapter);

    ListView myListView = (ListView)findViewById(R.id.noteList);
    aa = new FancyAdapter();

    final EditText price = (EditText)findViewById(R.id.price);
    final EditText name1 = (EditText)findViewById(R.id.name);
    final EditText result = (EditText)findViewById(R.id.result);
    myListView.setAdapter(aa);

    myListView.setOnItemClickListener(new OnItemClickListener() {
       public void onItemClick(AdapterView<?> arg0, View arg1,
                 int position, long arg3) {

           aa.notifyDataSetChanged();
        }
    });

    Button btnSimple = (Button)findViewById(R.id.btnSimple);        

    btnSimple.setOnClickListener(new OnClickListener() {
        public void onClick(View v)
        {
            double totalPrice = Double.parseDouble(price.getText().toString());
            int position = spinner.getSelectedItemPosition();
            name = name1.getText().toString();

            if(position == 0)
            {
                totalPrice = totalPrice * 1.07;
                total = String.valueOf(totalPrice);
                System.out.println(total);
                //result.setText(total); 
            }
            else
            {
                totalPrice = (totalPrice * 1.1)*1.07;
                total = String.valueOf(totalPrice);
                System.out.println(total);
                //result.setText(total); 
            }
            noteList.add(0, total); 
            System.out.println(total);
            name1.setText("");
            price.setText("");
            aa.notifyDataSetChanged();
        }
    });        

}

class FancyAdapter extends ArrayAdapter<String>
{
    Button calculate;
    EditText price;
    EditText result;

    FancyAdapter()
    {
        super(main.this, android.R.layout.simple_list_item_1, noteList);
    }

    public View getView(int position, View convertView, ViewGroup parent)
    {
        View row = convertView;     

        if(row == null)
        {
            LayoutInflater inflater = getLayoutInflater();
            row = inflater.inflate(R.layout.custom_list_item, null);
        }

        //((TextView)row.findViewById(R.id.nametv)).setText(noteList.get(position));
        ((EditText)row.findViewById(R.id.result)).setText(noteList.get(position));
        return (row);
    }
}

}

  • 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-31T19:09:32+00:00Added an answer on May 31, 2026 at 7:09 pm

    You can just send a whole string to the adapter. Then split the string up accordingly. You may want to add a colon or some identifier to split.

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

Sidebar

Related Questions

In main.xml I would like to have a spinner1 with two radio buttons and
My main layout main.xml has only a Button , a EditText and an empty
I am trying to design my application so that it has one main.xml layout
main.xml <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:id=@+id/root android:layout_width=match_parent android:layout_height=wrap_content android:orientation=vertical > <LinearLayout android:id=@+id/horizontal android:layout_width=fill_parent
1.) My main.xml contains : <ListView android:id="@+id/lsym" android:layout_width="wrap_content" android:layout_height="wrap_content"/> 2.) After populating the list,
In my layout file - main.xml(linear layout), there are 2 buttons(say b1 and b2),
I have a xml file main.xml with following markup and data. main.xml <xml> <content>
I added some UI elements to the main.xml file in the res\layout folder and
I have multiple textviews in main.xml <LinearLayout... > <textview adndroid:tag=A> ... till to Z.
I called my main activity Main, and Eclipse created Main.java and res/layout/main.xml for the

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.