Android Open Source - CloudPaste-Android Main List View Adapter

From Project

Back to project page CloudPaste-Android.


The source code is released under:

MIT License

If you think the Android project CloudPaste-Android 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.alwaysallthetime.cloudpaste.adapter;
/*from  w ww  .  j a v a 2s  . c  om*/
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.alwaysallthetime.cloudpaste.R;
import com.alwaysallthetime.messagebeast.model.MessagePlus;

import java.util.List;

public class MainListViewAdapter extends ArrayAdapter<MessagePlus> {
    private List<MessagePlus> mMessages;

    public MainListViewAdapter(Context context, List<MessagePlus> messages) {
        super(context, -1, messages);
        mMessages = messages;

    public void refresh(List<MessagePlus> items) {

    public void removeItemAt(int position) {

    public View getView(int position, View convertView, ViewGroup parent) {
        MessagePlus item = getItem(position);
        if(convertView == null) {
            convertView = new MainListViewAdapterLayout(getContext());
        return convertView;

    public class MainListViewAdapterLayout extends LinearLayout {

        TextView mTextView;

        public MainListViewAdapterLayout(Context context) {

            LayoutInflater.from(context).inflate(R.layout.adapter_main_list, this, true);
            mTextView = (TextView) findViewById(;

        public void setItem(MessagePlus message) {


Java Source Code List