Android Open Source - DynamicListView My Adapter






From Project

Back to project page DynamicListView.

License

The source code is released under:

Apache License

If you think the Android project DynamicListView listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.dynamiclistview;
//ww w.  jav a2  s . c o  m
import java.util.List;

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

public class MyAdapter extends ArrayAdapter<String> {  
    
    public MyAdapter(Context context, int textViewResourceId, List<String> objects) {  
        super(context, textViewResourceId, objects);  
    }  
  
    @Override  
    public View getView(int position, View convertView, ViewGroup parent) {  
        View view;  
        if (convertView == null) {  
            view = LayoutInflater.from(getContext()).inflate(R.layout.my_list_view_item, null);  
        } else {  
            view = convertView;  
        }  
        TextView textView = (TextView) view.findViewById(R.id.text_view);  
        textView.setText(getItem(position));  
        return view;  
    }  
  
}




Java Source Code List

com.example.dynamiclistview.DynamicListView.java
com.example.dynamiclistview.MainActivity.java
com.example.dynamiclistview.MyAdapter.java