Android Open Source - SerialPlot File Array Adapter






From Project

Back to project page SerialPlot.

License

The source code is released under:

MIT License

If you think the Android project SerialPlot 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 org.SerialPlot;
/*from www . ja va 2s.c  om*/
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 FileArrayAdapter extends ArrayAdapter<Option>{
  
  private Context c;
  private int id;
  private List<Option> items;
  
  public FileArrayAdapter(Context context, int textViewResourceId, List<Option> objects) {
    super(context, textViewResourceId, objects);
    c = context;
    id = textViewResourceId;
    items = objects;
  }
  
  public Option getItem(int i){
    return items.get(i);
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent){
    View v = convertView;
    if (v == null){
      LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      v = vi.inflate(id, null);
    }
    final Option o = items.get(position);
    if (o != null){
      TextView t1 = (TextView)v.findViewById(R.id.TextView01);
      TextView t2 = (TextView) v.findViewById(R.id.TextView02);
      
      if (t1 != null) t1.setText(o.getName());
      if (t2 != null) t2.setText(o.getData());
    }
    return v;
  }

}




Java Source Code List

org.SerialPlot.BTcom.java
org.SerialPlot.DataBuffer.java
org.SerialPlot.DeviceListActivity.java
org.SerialPlot.FileArrayAdapter.java
org.SerialPlot.FileBrowserActivity.java
org.SerialPlot.Option.java
org.SerialPlot.SerialPlotActivity.java