How to pass the value of setOnDateChangeListener to DATABASE_NAME?
I formatted my dbhelper like this
public static String getDateTime() {
        SimpleDateFormat dateFormat = new SimpleDateFormat(
                "yyyyMMdd", Locale.getDefault());
        Date date = new Date();
        return dateFormat.format(date);
    }
    // Database Name
    private static final String DATABASE_NAME = getDateTime();
While I formatted my calendar setOnDateChangeListener just like how I formatted my DATABASE_NAME.
Below is my repo class which gets the sum(Fats) from the date today.
What I want is to get the sum(Fats) from the date I clicked on the calendar.
public double totalFatB(){
        SQLiteDatabase db = dbHelper.getReadableDatabase();
        String query = "SELECT SUM(Fat) FROM " +breakfast.TABLE;
        Cursor c = db.rawQuery(query, null);
        c.moveToFirst();
        double i=c.getDouble(0);
        return i;
    }
Here is my onDateChangeListener
CalendarView calendarView=(CalendarView) findViewById(R.id.calendarView);
        calendarView.setOnDateChangeListener(new CalendarView.OnDateChangeListener() {
            @Override
            public void onSelectedDayChange(CalendarView view, int year, int month,
                                            int dayOfMonth) {
                month = month+1;
                if ((month == 1) || (month == 2)|| (month == 3)|| (month == 4)|| (month == 5)|| (month == 6)|| (month == 7)|| (month == 8)|| (month == 9) )
                {
                    String m= "0"+month;
                    if ((dayOfMonth == 1) || (dayOfMonth == 2)|| (dayOfMonth == 3)|| (dayOfMonth == 4)|| (dayOfMonth == 5)|| (dayOfMonth == 6)|| (dayOfMonth == 7)|| (dayOfMonth == 8)|| (dayOfMonth == 9) ) {
                        String d = "0" + dayOfMonth;
                         date= year +""+ m +""+ d;
                        Toast.makeText(getApplicationContext(),date, Toast.LENGTH_LONG).show();
                        /*Toast.makeText(getApplicationContext(), "" + year + m + d, Toast.LENGTH_LONG).show();*/
                    }
                        else
                        {
                             date= year +""+ m +""+ dayOfMonth;
                            Toast.makeText(getApplicationContext(),date, Toast.LENGTH_LONG).show();
                            /*Toast.makeText(getApplicationContext(), "" + year + m + dayOfMonth, Toast.LENGTH_LONG).show();*/
                        }
                }
                else if ((dayOfMonth == 1) || (dayOfMonth == 2)|| (dayOfMonth == 3)|| (dayOfMonth == 4)|| (dayOfMonth == 5)|| (dayOfMonth == 6)|| (dayOfMonth == 7)|| (dayOfMonth == 8)|| (dayOfMonth == 9) ) {
                    String d = "0" + dayOfMonth;
                     date= year +""+ month +""+ d;
                    Toast.makeText(getApplicationContext(),date, Toast.LENGTH_LONG).show();
                    /*Toast.makeText(getApplicationContext(), "" + year + month + d, Toast.LENGTH_LONG).show();*/
                }
                    else
                {
                    date= year +""+ month +""+ dayOfMonth;
                    Toast.makeText(getApplicationContext(),date, Toast.LENGTH_LONG).show();
                    /*Toast.makeText(getApplicationContext(), "" + year + month + dayOfMonth, Toast.LENGTH_LONG).show();*/
                }
            }
        });
 
     
    