Android Open Source - BluetoothGlass Bluetooth Devices Adapter

From Project

Back to project page BluetoothGlass.


The source code is released under:

GNU General Public License

If you think the Android project BluetoothGlass 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.vicmns.bluetoothglass.client.adapters;
//from   w  w  w  .  j a v  a  2s  .co  m
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import com.vicmns.bluetoothglass.client.callbacks.CardScrollCallBacks;
import com.vicmns.bluetoothglass.client.models.BluetoothDeviceModel;

import java.util.ArrayList;
import java.util.List;

 * Created by Victor Cervantes on 3/14/14.
public class BluetoothDevicesAdapter extends CardScrollAdapter {
    private Context ctx;
    private List<Card> mCards;
    private List<BluetoothDeviceModel> mDevices;
    private Card card;
    private CardScrollCallBacks cardScrollCallBacks;

    public BluetoothDevicesAdapter(Context ctx) {
        this.ctx = ctx;
        mCards = new ArrayList<Card>();
        mDevices = new ArrayList<BluetoothDeviceModel>();

    public void setCardScrollCallBacks(CardScrollCallBacks cardScrollCallBacks) {
        this.cardScrollCallBacks = cardScrollCallBacks;

    public void add(BluetoothDeviceModel bDevice) {
        for(BluetoothDeviceModel cDevice: mDevices) {


    private Card createDeviceCard(BluetoothDeviceModel bDevice) {
        card = new Card(ctx);
        return card;

    public int findIdPosition(Object arg0) {
        return 0;

    public int findItemPosition(Object item) {
        return mDevices.indexOf(item);

    public int getCount() {
        return mDevices.size();

    public Object getItem(int position) {
        return mDevices.get(position);

    public View getView(int position, View convertView, ViewGroup parent) {
        return mCards.get(position).toView();

Java Source Code List