• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
  • Mikalai Zaikin

populate a custom listview with edittext data

Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
package com.razen.xx;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class MySimpleArrayAdapter extends ArrayAdapter<String> {
private final Context context;
private final String[] values;

public MySimpleArrayAdapter(Context context, String[] values) {
super(context, R.layout.sample, values);
this.context = context;
this.values = values;
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
View rowView = inflater.inflate(R.layout.sample, parent, false);
TextView textView = (TextView) rowView.findViewById(R.id.firstLine);
ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
// Change the icon for Windows and iPhone

return rowView;

package com.razen.xx;

import android.app.ListActivity;
import android.os.Bundle;

public class Xmain extends ListActivity {
public void onCreate(Bundle icicle) {
String[] values = new String[] { "Android", "iPhone", "WindowsMobile",
"Blackberry", "WebOS", "Ubuntu", "Windows7", "Max OS X",
"Linux", "OS/2" };
MySimpleArrayAdapter adapter = new MySimpleArrayAdapter(this, values);

The code above works fine. I need to populate the listview with data from an edittext and a button and remove the constant values. Please help
    Bookmark Topic Watch Topic
  • New Topic