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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:59:28+00:00 2026-05-28T19:59:28+00:00

I need the user to enter graph coordinates. Problem is, I don’t know how

  • 0

I need the user to enter graph coordinates. Problem is, I don’t know how many. So I want to have an “Add Point” button which inserts two fields (for x and y coordinates) into a new table row for the user to add more coordinates.

Also, how do I identify these new fields when I want to get data from them? Normally, I already know the ID of the field and call them using findViewById(R.id.ID_here); Now what do I do to identify them?

I’m writing all these coordinates into a file, so if there’s a way to write them without identifying each one, please help.

EDIT:

I can’t get the edittext fields to have these layout parameter properties:

android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_weight="1"
android:inputType="numberDecimal"

Here’s my JAVA code for the same:

            TableLayout table = (TableLayout) findViewById(R.id.TableLayout1);

            TableRow tr = new TableRow(this);
            LinearLayout.LayoutParams trparams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
            tr.setLayoutParams(trparams);

            cg[i] = new EditText(this);
            weight[i] = new EditText(this);
            LinearLayout.LayoutParams fieldparams = new LinearLayout.LayoutParams(100, LinearLayout.LayoutParams.WRAP_CONTENT, 1.0f);
            cg[i].setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
            weight[i].setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
            cg[i].setLayoutParams(fieldparams);
            weight[i].setLayoutParams(fieldparams);

            tr.addView(cg[i]);
            tr.addView(weight[i]);

            table.addView(tr);

Please help if you can.

  • 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-28T19:59:29+00:00Added an answer on May 28, 2026 at 7:59 pm

    You can create new rows (or any other kind of View) like this:

    TableRow tr = new TableRow(myContext); // usually myContext is 'this'
    

    you then add the tr to whatever the parent view is

    TableLayout myTable = findViewById(R.id.TableLayout1);
    
    LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    tr.setLayoutParams(lp);
    myTable.addView(tr);
    

    You’ll need to add layoutParams to the view before you add it since all Views have to, at minimum, specify their layout width and layout height.

    If you need to add children to your row (obviously you will, what use is it otherwise) you just repeat the process except now you create an EditText. Once you do, you automatically have a reference to it, since you created it! 🙂

    I’m not clear on what you mean by the last part of your question, where you’re writing them to a file. Please elaborate.

    Oh, and welcome to Stack… if you find answers useful, don’t forget to up-vote them and/or mark them as correct.

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

Sidebar

Related Questions

i want something like this the user enter a website link i need check
I have a form where a user need to enter date and time (2
i have a simple problme. I need to catch when a user enter an
user enter two date it need to click on a button... if the date
I have an android Activity where I need to have the user enter some
I have a problem with ArrayList in C#, I know how can I add
I have an Arraylist . If user enter the same number secondly I want
I need a user to be able to enter a URL, and would like
I need a solution where a user could enter the URL of a web
I need a form to enable user to enter event info in three fields

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.