Android Open Source - BLETest Le Device List Adapter






From Project

Back to project page BLETest.

License

The source code is released under:

MIT License

If you think the Android project BLETest 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

/**
 * // w  w  w.j a va2  s  .co  m
 */
package com.binovsky.bletest;

import java.util.ArrayList;

import android.bluetooth.BluetoothDevice;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;

/**
 * @author mbinovsky
 *
 */
public class LeDeviceListAdapter extends BaseAdapter
{
  private ArrayList<BluetoothDevice> mDevices;

  /**
   * 
   */
  public LeDeviceListAdapter( )
  {
    // TODO Auto-generated constructor stub
  }
  
  /**
   * @return the mDevices
   */
  public ArrayList<BluetoothDevice> getMDevices( )
  {
    return mDevices;
  }

  /**
   * @param mDevices the mDevices to set
   */
  public void setMDevices( ArrayList<BluetoothDevice> mDevices )
  {
    this.mDevices = mDevices;
  }

  /* (non-Javadoc)
   * @see android.widget.Adapter#getCount()
   */
  @Override
  public int getCount( )
  {
    return getMDevices( ).size( );
  }

  /* (non-Javadoc)
   * @see android.widget.Adapter#getItem(int)
   */
  @Override
  public Object getItem( int position )
  {
    return getMDevices( ).get( position );
  }

  /* (non-Javadoc)
   * @see android.widget.Adapter#getItemId(int)
   */
  @Override
  public long getItemId( int position )
  {
    return -1;
  }

  /* (non-Javadoc)
   * @see android.widget.Adapter#getView(int, android.view.View, android.view.ViewGroup)
   */
  @Override
  public View getView( int position, View convertView, ViewGroup parent )
  {
    return null;
  }

  public void addDevice( BluetoothDevice device )
  {
    getMDevices( ).add( device );
  }
}




Java Source Code List

com.binovsky.bletest.LeDeviceListAdapter.java
com.binovsky.bletest.MainActivity.java