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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:27:14+00:00 2026-06-13T14:27:14+00:00

I have a edit text and a Save button inside my list view. I

  • 0

I have a edit text and a Save button inside my list view. I have to clear the text when the user clicks the save button. I have tried like

txtDescription.setText("");

But not worked. Any one know why it is not worked ? The Adapter class is attached

Please Help Me, Thanks in Advance!!

private class ListAdapters extends ArrayAdapter<ApplicationBean> {
    private ArrayList<ApplicationBean> items;
    private int position;

    public ListAdapters(Context context, int textViewResourceId,
            ArrayList<ApplicationBean> mTitleList) {
        super(context, textViewResourceId, mTitleList);
        this.items = mTitleList;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View v = convertView;
        this.position = position;
        if (v == null) {
            LayoutInflater inflater = (LayoutInflater) mContext
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            v = inflater.inflate(R.layout.applicationlistitem, null);
        }

        final ApplicationBean o = (ApplicationBean) items.get(position);

        if (o != null) {

            txtDescription = (EditText) v
                    .findViewById(R.id.description_text);



            submitButton = (Button) v.findViewById(R.id.submit_btn);
            submitButton.setTag(position);
            submitButton.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {

                        PostRequest p = new PostRequest(Integer.parseInt(v
                                .getTag().toString()));
                        p.execute();
                }

            });
        }
        return v;
    }

    @Override
    public int getItemViewType(int position) {
        // TODO Auto-generated method stub
        return position;
    }

    @Override
    public int getViewTypeCount() {
        // TODO Auto-generated method stub
        return items.size();
    }

}



private class PostRequest extends AsyncTask<Void, Void, String> {
    ProgressDialog dlgprogress;
    int position;

    public PostRequest(int selectedIndex) {
        position = selectedIndex;
    }

    @Override
    protected void onPostExecute(String result) {
        dlgprogress.dismiss();
        final Dialog dlg = new AlertDialog.Builder(mContext)
                .setTitle("Message")
                .setMessage(result)
                .setPositiveButton("Ok",
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog,
                                    int whichButton) {
                                dlgprogress.dismiss();
                                dlgprogress.cancel();
                                txtDescription.setText("");
                            }
                        }).create();
        dlg.show();
        super.onPostExecute(result);
    }

    @Override
    protected void onPreExecute() {
        dlgprogress = ProgressDialog.show(mContext, "", "Please wait");
        // dlgprogress.show(mContext, "", "Please wait");
        super.onPreExecute();
    }

    @Override
    protected String doInBackground(Void... arg0) {
        //do something.............
        //..........................
        dlgprogress.dismiss();
        return rsponse;
    }

}

applicationlistitem.xml

 <?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="wrap_content"
    android:orientation="vertical" 
    android:background="#FFFFFF">



    <LinearLayout
        android:id="@+id/lineatlayout1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

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

        <EditText
            android:id="@+id/description_text"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:clickable="true"
            android:ems="10"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:inputType="textMultiLine" 
            android:textColor="#000000">
        </EditText>
    </LinearLayout>

    <Button
        android:id="@+id/submit_btn"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="SUBMIT" />

   </LinearLayout>
  • 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-13T14:27:15+00:00Added an answer on June 13, 2026 at 2:27 pm

    You can also set any object as TAG to your button view.

    So do it like this in your getView() method and I supppose it will work.

                 //EDIT
             txtDescription.setTag(position); // set position to edittext
    
             submitButton = (Button) v.findViewById(R.id.submit_btn);
             submitButton.setTag(txtDescription); // set the current edittext object 
    
             submitButton.setOnClickListener(new OnClickListener() {        
                    @Override
                    public void onClick(View v) {
                           EditText tv = (EditText)v.getTag(); // get edittext object
                           tv.setText("");
                                 //Edit
                           PostRequest p = new PostRequest(Integer.parseInt(tv
                                    .getTag().toString())); // get position from edittext
                        }
                    });
    

    EDIT TO SEND Complete View

    I have not tested this, but I suppose it will work if don’t work then also send the Checkbox to constructor as you send editext.

    class PostTask extends AsyncTask<Void,Void,Void>
    {
        CheckBox cb;
        EditText et;
        int pos;
        PostTask(int pos,View view)
        {
            cb = view.findViewById(R.id.cbox1);
            et = view.findViewById(R.id.et1);
            pos = Integer.parseInt(et.getTag().toString());
        }
    }
    

    //Now in getView change

    submitButton.setOnClickListener(new OnClickListener() {     
                @Override
                public void onClick(View v) {
                       PostRequest p = new PostRequest((View)v.getParent()); // get position from edittext
                }
     });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have 3 Edit Text , one save button and one read button. Already
I have an application that allows the user to edit multiple text fields and
i have to make a notepad where i write,edit,clear the text. this notepad need
I have a program which has a text box that the user can edit.
I have a template like script type: text/template, id: list-template, ''' <div class=display> <div
in my application I have 3 edit boxes where the user enters in text.
I have an edit text which functions as a search box in my application.
In my application, in an activity i have 4 edit Text fields and a
I have a text file that I want to edit by rewriting it to
I have a text file that I want to edit using Java. It has

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.