Android Open Source - android-location-notes Drawer Adapter






From Project

Back to project page android-location-notes.

License

The source code is released under:

Apache License

If you think the Android project android-location-notes 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.nearsoft.examenboom;
/*ww  w  .ja  va2  s  .  c  om*/
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

/**
 * Created by jsalcido on 7/27/14.
 */
public class DrawerAdapter extends BaseAdapter {

    private LayoutInflater inflater;
    private final String[] items;
    private int size;

    public DrawerAdapter(Context context, String[] itemsArray) {
        items = itemsArray;
        size = itemsArray.length;
        inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return size;
    }

    @Override
    public Object getItem(int position) {
        return items[position];
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        ViewHolder holder = null;

        if (convertView == null) {
            convertView = inflater.inflate(R.layout.row_drawer, null);
            holder = new ViewHolder();
            holder.text = (TextView) convertView.findViewById(R.id.drawer_text);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }

        setText(holder, position);
        return convertView;
    }

    private void setText(ViewHolder holder, int position) {
        holder.text.setText((String) getItem(position));
    }

    private class ViewHolder {
        TextView text;
    }
}




Java Source Code List

com.nearsoft.examenboom.ApplicationTest.java
com.nearsoft.examenboom.DrawerAdapter.java
com.nearsoft.examenboom.ExamenApplication.java
com.nearsoft.examenboom.MainActivity.java
com.nearsoft.examenboom.NewNoteActivity.java
com.nearsoft.examenboom.NoteMapFragment.java
com.nearsoft.examenboom.NotesAdapter.java
com.nearsoft.examenboom.NotesFragment.java
com.nearsoft.examenboom.NotesMapFragment.java
com.nearsoft.examenboom.ViewNoteActivity.java
com.nearsoft.examenboom.common.Note.java
com.nearsoft.examenboom.database.NoteDatabaseAccess.java
com.nearsoft.examenboom.database.NotesSQLite.java
com.nearsoft.examenboom.database.repository.NoteRepositoryImpl.java
com.nearsoft.examenboom.database.repository.NoteRepository.java