Back to project page cnp.
The source code is released under:
MIT License
If you think the Android project cnp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.urucas.copynpaste.adapters; /*w w w.j a v a 2s .c o m*/ import java.util.ArrayList; import com.urucas.copynpaste.model.Post; import com.urucas.copynpaste.R; import android.content.Context; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; public class PostsAdapter extends ArrayAdapter<Post>{ public PostsAdapter(Context context, int resource, ArrayList<Post> posts) { super(context, resource, posts); } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) this.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); Post _post = getItem(position); View rowView = inflater.inflate(R.layout.adapter_post_item, parent, false); TextView data = (TextView) rowView.findViewById(R.id.postData); data.setText(_post.getData()); return rowView; } public void addAll(ArrayList<Post> _posts) { for(int i=0; i<_posts.size();i++) { Post post = _posts.get(i); Log.i("post data", post.getData()); this.insert(post, this.getCount()); } } }