Android Open Source - legacy_bluetrack Live Tracking Cursor Adapter

From Project

Back to project page legacy_bluetrack.


The source code is released under:

GNU General Public License

If you think the Android project legacy_bluetrack 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.jonblack.bluetrack.adapters;
/*from w ww.  j a va 2  s  .c  o m*/
import org.jonblack.bluetrack.BluetoothClassLookup;
import org.jonblack.bluetrack.R;

import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

public class LiveTrackingCursorAdapter extends CursorAdapter
  public LiveTrackingCursorAdapter(Context context, Cursor cursor, int flags)
    super(context, cursor, flags);
  public void bindView(View view, Context context, Cursor cursor)
    int colIdMajorClass = cursor.getColumnIndexOrThrow("major_class");
    final int majorClass = cursor.getInt(colIdMajorClass);
    int colIdMinorClass = cursor.getColumnIndexOrThrow("minor_class");
    final int minorClass = cursor.getInt(colIdMinorClass);
    int classIconId = BluetoothClassLookup.getIconId(majorClass, minorClass);
    ImageView ivClass = (ImageView) view.findViewById(;
    TextView tvMac = (TextView) view.findViewById(;
    int idMac = cursor.getColumnIndexOrThrow("mac_address");
    TextView tvName = (TextView) view.findViewById(;
    int idName = cursor.getColumnIndexOrThrow("name");
    TextView tvRssi = (TextView) view.findViewById(;
    int idRssi = cursor.getColumnIndexOrThrow("rssi");

  public View newView(Context context, Cursor cursor, ViewGroup parent)
    LayoutInflater inflater = LayoutInflater.from(context);
    final View view = inflater.inflate(R.layout.live_tracking_list_row, parent,
    return view;

Java Source Code List