Android Open Source - BluetoothSPP Device Adapter






From Project

Back to project page BluetoothSPP.

License

The source code is released under:

MIT License

If you think the Android project BluetoothSPP 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.outofjungle.bluetoothspp.app;
/*from   w  w w  . j  a  v a 2s  .c o  m*/
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import java.util.ArrayList;

public class DeviceAdapter extends ArrayAdapter<BluetoothDevice> {
  public DeviceAdapter(Context context, ArrayList<BluetoothDevice> devices) {
    super(context, R.layout.device_item, devices);
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    if (convertView == null) {
      convertView = LayoutInflater.from(getContext()).inflate(R.layout.device_item, parent, false);
    }

    BluetoothDevice device = getItem(position);
    TextView deviceTextView = (TextView) convertView.findViewById(R.id.deviceTextView);
    deviceTextView.setText(device.getName() + "\n   " + device.getAddress());
    return convertView;
  }
}




Java Source Code List

com.outofjungle.bluetoothspp.app.ConnectActivity.java
com.outofjungle.bluetoothspp.app.ConsoleActivity.java
com.outofjungle.bluetoothspp.app.DeviceAdapter.java
com.outofjungle.bluetoothspp.app.MessageAdapter.java
com.outofjungle.bluetoothspp.app.models.Message.java
com.outofjungle.bluetoothspp.app.models.Writer.java