Android Open Source - Joetz-Android-V2 Joetz Activities Adapter

From Project

Back to project page Joetz-Android-V2.


The source code is released under:

GNU General Public License

If you think the Android project Joetz-Android-V2 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.example.jens.myapplication.activities;
/*  w  ww  . j  a  v  a2 s .co m*/
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.example.jens.myapplication.R;
import com.example.jens.myapplication.util.DateTimeStringConverter;

import java.util.List;

 * Created by Sam on 4/12/2014.
public class JoetzActivitiesAdapter extends RecyclerView.Adapter<JoetzActivitiesAdapter.ViewHolder> {
    private List<JoetzActivity> activities;

    public JoetzActivitiesAdapter(List<JoetzActivity> activities){
        this.activities = activities;

    public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new ViewHolder(LayoutInflater.from(viewGroup.getContext()).inflate(
                R.layout.item_joetzactivity, viewGroup, false));

    public void onBindViewHolder(ViewHolder viewHolder, int i) {
        final JoetzActivity activity = activities.get(i);

        viewHolder.txtDob.setText(DateTimeStringConverter.getSimpleDate(activity.getStartDate()) +
            " - " + DateTimeStringConverter.getSimpleDate(activity.getEndDate()));

    public int getItemCount() {
        return activities == null ? 0 : activities.size();

    public static class ViewHolder extends RecyclerView.ViewHolder{
        private TextView txtTitle;
        private TextView txtDob;
        private TextView txtLocation;
        private TextView txtSummary;

        public ViewHolder(View v) {
            txtTitle = (TextView) v.findViewById(;
            txtDob = (TextView) v.findViewById(;
            txtLocation = (TextView) v.findViewById(;
            txtSummary = (TextView) v.findViewById(;

Java Source Code List