0

Actually I am using the caldroid library for android but in it I could not find any proper documentation for setBackgroundResourceForDate function. The files I have imported are:-

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.v4.app.FragmentTransaction;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.roomorama.caldroid.CaldroidFragment;
import com.roomorama.caldroid.CaldroidListener;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;

and here the setBackgroundResourceForDate is being showed in red:-

if (caldroidFragment != null) {
            caldroidFragment.setBackgroundResourceForDate(R.color.blue,
                    blueDate);
            caldroidFragment.setBackgroundResourceForDate(R.color.green,
                    greenDate);
            caldroidFragment.setTextColorForDate(R.color.white, blueDate);
            caldroidFragment.setTextColorForDate(R.color.white, greenDate);
        }
lmgguy
  • 89
  • 2
  • 8

1 Answers1

0

As far as i can see there is no method defined with the name 'setBackgroundResourceForDate'in class :import com.roomorama.caldroid.CaldroidFragment; instead you could use setBackgroundDrawableForDate(Drawable drawable, Date date)

You can implement it like this:

if (caldroidFragment != null) {
            caldroidFragment.setBackgroundDrawableForDate(R.color.blue,
                    blueDate);
            caldroidFragment.setBackgroundDrawableForDate(R.color.green,
                    greenDate);
            caldroidFragment.setTextColorForDate(R.color.white, blueDate);
            caldroidFragment.setTextColorForDate(R.color.white, greenDate);
        }
Abhilash Maurya
  • 302
  • 3
  • 18
  • but i am getting an error ...its showing wrong first argument type!! – lmgguy Feb 10 '17 at 12:32
  • Ohh yes. First arg must be a Drawable type not a color id(int) – Abhilash Maurya Feb 10 '17 at 13:40
  • but how is it useful then ? I wanted it to be a color..can you pls tell me how you check if a method is defined in a class? how did you check it in my case? – lmgguy Feb 10 '17 at 16:19
  • You can use _`getResources().getDrawable(R.color.blue)`_ instead of using color resource id. You can check if a method is defined for your class from its documentation or you can just walkthrough the class code.. – Abhilash Maurya Feb 10 '17 at 18:30