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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:59:46+00:00 2026-05-29T20:59:46+00:00

I’m at a lose with this one. Trying to take edittext from a list

  • 0

I’m at a lose with this one. Trying to take edittext from a list view and put them into an arraylist to use on another activity.

public class editpage extends ListActivity {
    public static String editString;
    private dbadapter mydbhelper;
    public static ArrayList<String> editTextList = new ArrayList<String>();


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.edit_list);
        mydbhelper = new dbadapter(this);
        mydbhelper.open();
        fillData();
    }



    public void fillData() {


        Cursor e = mydbhelper.getUserWord();
            startManagingCursor(e);


        String[] from = new String[] {dbadapter.KEY_USERWORD,};

        int[] to = new int[] {R.id.textType,};


       SimpleCursorAdapter editadapter = 
       new SimpleCursorAdapter(this, R.layout.edit_row, e, from, to);
       ListView list = getListView();
       View footer = getLayoutInflater().inflate(R.layout.footer_layout, list, false);
       list.addFooterView(footer);
       setListAdapter(editadapter);

                }






    public void onClick(View footer){
            final MediaPlayer editClickSound = MediaPlayer.create(this, R.raw.button50);
            final EditText editText = (EditText) findViewById(R.id.editText);
            for (int i = 0; i < getCount(); i++){
            editTextList.add(editText.getText().toString());
                        }
            editClickSound.start();
            startActivity(new Intent("wanted.pro.madlibs.OUTPUT"));
                    };







//can't get my getcount to work dynamically. I want it to be based off how many items are shown in next code showing my cursor but can't get to work atm unless I set statically to prevent errors and move to next activity
private int getCount() {
        // TODO Auto-generated method stub
        return 10;
    }



Cursor to filter data pulled from database

  public  Cursor getUserWord() 
        {
            return myDataBase.query(USER_WORD_TABLE, new String[] {
                    KEY_ID, 
                    KEY_CATEGORY,
                    KEY_SOURCE, KEY_TITLE, KEY_USERWORD 
                    }, 
                    KEY_CATEGORY+ "=" + categories.categoryClick + " AND " + KEY_SOURCE+ "=" 
                    +source.sourceClick + " AND " + KEY_TITLE+ "=" + title.titleClick, 
                    null, null, null, KEY_ID);

Cursor to filter data from database to show in listview

      public  Cursor getUserWord() 
        {
            return myDataBase.query(USER_WORD_TABLE, new String[] {
                    KEY_ID, 
                    KEY_CATEGORY,
                    KEY_SOURCE, KEY_TITLE, KEY_USERWORD 
                    }, 
                    KEY_CATEGORY+ "=" + categories.categoryClick + " AND " + KEY_SOURCE+ "=" 
                    +source.sourceClick + " AND " + KEY_TITLE+ "=" + title.titleClick, 
                    null, null, null, KEY_ID);
        }

My next activity will be showing the edittext merged with a string from my database. I take this string and replace edit01, edit02 etc with the users input from edittext fields on previous activity

public class output extends ListActivity {
    private dbadapter mydbhelper;
    @Override
    public void onCreate(Bundle savedInstantState){
        super.onCreate(savedInstantState);
        setContentView(R.layout.outview);
        mydbhelper = new dbadapter(this);
        mydbhelper.open();
        fillData();
        }

private final Runnable mTask = new Runnable(){
    public void run(){
        TextView textView = (TextView)findViewById(R.id.outputText);
        String story = textView.getText().toString();
CharSequence modifitedText1 = Replacer.replace(story, 
            "edit01", Html.fromHtml("<font color=\"red\">"+ editpage.editTextList.get(0) +"</font>"));
CharSequence modifitedText2 = Replacer.replace(modifitedText1, 
        "edit02", Html.fromHtml("<font color=\"red\">"+ editpage.editTextList.get(1) +"</font>"));
textView.setText(modifitedText2);
    }
};
private final Handler mHandler = new Handler();


    private void fillData() {

        Cursor st = mydbhelper.getStory();
            startManagingCursor(st);


        String[] from = new String[] {dbadapter.KEY_TITLESTORY};

        int[] to = new int[] {R.id.outputText};


        SimpleCursorAdapter adapter = 
            new SimpleCursorAdapter(this, R.layout.out_row, st, from, to);
        setListAdapter(adapter);
        }
    @Override
    protected void onResume() {
        mydbhelper.open();
        mHandler.postDelayed(mTask, 10);
        super.onResume();
    }

    @Override
    protected void onPause() {
        mydbhelper.close();
        super.onPause();
    }


}

The furthest I can get this to work is with one item. I will be having anywhere from 4-10 edittexts on the first activity I show here. But no matter what I’ve tried it will only display the text entered into the first edittext field. In it’s current state it will fill edit01 & edit02 in the string from database with what was put in first edittext in previous activity.

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

    Well was finally able to get this to work without changing to much. I had to fight with it and try a bunch of things. Figured I would share the answer in case someone tries something like this. It came down to changing (R.id.editText) to have its own unique id.

    private void editId(){
        if(findViewById(R.id.editText) == null){
    
        }else{
    
        for(int editI= 0; editI<getCount(); editI++){
            EditText editText = (EditText) findViewById(R.id.editText);
            editText.setId(editI);
            m_edit.add(editI, editText);
        }}
    }
    

    and calling editId() in my onclick for my footer button

    I had to change my runnable to work dynamically but that is another issue.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am currently running into a problem where an element is coming back from
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka

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.