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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:26:37+00:00 2026-06-18T12:26:37+00:00

Im new to android im desingnig one app description is… i have kept one

  • 0

Im new to android im desingnig one app description is…
i have kept one edit text and one button whenevr i click on the button i have to store that value in a list… i tried like this
I didnt get where theerror is….

  public class Dynamic extends Activity {


 ArrayList<Getters> x=new ArrayList<Getters>();



@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Button b=(Button)findViewById(R.id.nameok);
    final EditText ed=(EditText)findViewById(R.id.name);
    b.setOnClickListener(new OnClickListener() {

        public void onClick(View v) {

            // TODO Auto-generated method stub
            String name=ed.getText().toString();
            Getters y=new Getters(name);
            x.add(y);
            ListView lv= (ListView)findViewById(R.id.listView1);
            Demo demo=new Demo();
        lv.setAdapter(demo);

        }
    });




}
public class Demo extends BaseAdapter
{

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

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

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

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // TODO Auto-generated method stub
        View v = convertView;

        if (v == null) {
            LayoutInflater vi = LayoutInflater.from(parent.getContext());
            v = vi.inflate(R.layout.forlist, null);
        }
        //View v=LayoutInflater.from(getApplicationContext()).inflate(R.layout.forlist, null);
        TextView listname=(TextView)findViewById(R.id.listname);
        listname.setText(x.get(position).name);

        return v;
    }

}




public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.activity_main, menu);
    return true;
}
   }

getters..

 public class Getters {
public Getters(String name) {

    this.name = name;
}

String name;

public String getName() {

     Log.v("name---",""+name);
    return name;

}

}

  • 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-18T12:26:39+00:00Added an answer on June 18, 2026 at 12:26 pm

    please First see this and then implement your code so its easy to implement.

    Edit :

    http://www.framentos.com/en/android-tutorial/2012/07/16/listview-in-android-using-custom-listadapter-and-viewcache/

    Hope you will get idea about how to manage list data dynamically.

    Edit

    Just write below code for add event in List view

    b.setOnClickListener(new OnClickListener() {
    
            public void onClick(View v) {
    
                // TODO Auto-generated method stub
                String name=ed.getText().toString();
                your List_view_obj.add(name);
                //call adapter class and pass that string                
               your List_view_obj.setAdapter(your adapter's obj);
    
               your_adapter_obj.notifyDataSetChanged();
    
    
    
            }
        });
    

    Hope you got it.

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

Sidebar

Related Questions

I am New Android development. In My application I have two ArrayLists. One ArrayList
I have a new project involving the build of an Android app for a
i am creating a new android application.i am using the table layout. I have
I am a new android app developer and i want to use google map
I am new android app developer i want make app for tablets and phone
I'm using the new Android Facebook SDK 3.0. I'm implementing the login button in
In my new android program i need to send one request to a PHP
I am new comer to android but not to java. I have been designing
My new Android app is crashing when I run it on my phone, but
I'm new to android programming, but one thing that I can't seem to get

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.