Android Open Source - Bucky Simple Dataset Cursor Adapter






From Project

Back to project page Bucky.

License

The source code is released under:

GNU General Public License

If you think the Android project Bucky 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 net.tedstein.Bucky.util;
//from  w ww .  j av a 2s. c  o  m
import net.tedstein.Bucky.BuckyProvider;
import android.content.Context;
import android.database.Cursor;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;

/*
 * This class will produce a list that shows only the name of each set. To also display the
 * createdAt time, check out DatasetCursorAdapter.
 */
public class SimpleDatasetCursorAdapter extends CursorAdapter {
    public SimpleDatasetCursorAdapter(Context context, Cursor c) {
        super(context, c);
    }

    @Override
    public View newView(Context context, Cursor cursor, ViewGroup parent) {
        TextView name_view = new TextView(context);
        name_view.setTextSize(24);
        name_view.setPadding(3, 4, 0, 4);
        return name_view;
    }

    @Override
    public void bindView(View view, Context context, Cursor cursor) {
        int id_index = cursor.getColumnIndex(BuckyProvider.DS_ID);
        int name_index = cursor.getColumnIndex(BuckyProvider.DS_NAME);

        ((TextView)view).setText(cursor.getString(name_index));

        // Store an Integer with the set's ID as view's tag for later retrieval.
        view.setTag(new Integer(cursor.getInt(id_index)));
    }
}




Java Source Code List

net.tedstein.Bucky.BuckyProvider.java
net.tedstein.Bucky.CreateSet.java
net.tedstein.Bucky.Overview.java
net.tedstein.Bucky.SetDetail.java
net.tedstein.Bucky.util.DatapointAdder.java
net.tedstein.Bucky.util.DatapointCursorAdapter.java
net.tedstein.Bucky.util.DatasetCursorAdapter.java
net.tedstein.Bucky.util.SetChoiceHandler.java
net.tedstein.Bucky.util.SetChooser.java
net.tedstein.Bucky.util.SimpleDatasetCursorAdapter.java