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.
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.support.v4.widget.CursorAdapter; 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); } @Override 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(R.id.live_tracking_row_class); ivClass.setImageResource(classIconId); TextView tvMac = (TextView) view.findViewById(R.id.live_tracking_row_mac); int idMac = cursor.getColumnIndexOrThrow("mac_address"); tvMac.setText(cursor.getString(idMac)); TextView tvName = (TextView) view.findViewById(R.id.live_tracking_row_name); int idName = cursor.getColumnIndexOrThrow("name"); tvName.setText(cursor.getString(idName)); TextView tvRssi = (TextView) view.findViewById(R.id.live_tracking_signal_strength); int idRssi = cursor.getColumnIndexOrThrow("rssi"); tvRssi.setText(cursor.getString(idRssi)); } @Override 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, false); return view; } }