I got this adapter from a website as a code snippet but I’m not really sure how to call it in main class of my program.
Snippet:
public MonthAdapter(Context c, int month, int year, DisplayMetrics metrics) {
mContext = c;
mMonth = month;
mYear = year;
mCalendar = new GregorianCalendar(mYear, mMonth, 1);
mCalendarToday = Calendar.getInstance();
mDisplayMetrics = metrics;
populateMonth();
}
Main:
GridView gridview = (GridView) findViewById(R.id.gridView1);
gridview.setAdapter(new MonthAdapter(null, 0, 0, null ));
I am not sure about the arguments for MonthAdapter, if someone could help me I would be really grateful!
For Context you can pass the Activity’s instance like SomeScreen.this or
getParent().for month and year it depends on what you do with that in the adapter. Give us more details on what is your intention of using the adapter.
for metrics you can pass like
But definetely don’t pass null.