Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8508595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:12:16+00:00 2026-06-11T03:12:16+00:00

here is the image and i want to show only current month days not

  • 0

enter image description here
here is the image and i want to show only current month days not next and not previous days.
here is my adapter code and i mange and set the days from adapter.and in class file i have set the adapter in gridview. can u please help?

package com.ManageMyTimeTableAdapter;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import android.content.Context;
import android.graphics.Color;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import com.ManageMyTimeTable.CalendarView;
import com.ManageMyTimeTable.DaliyScreenActivity;
import com.ManageMyTimeTable.DateUtils;
import com.ManageMyTimeTable.R;

public class CalendarAdapter extends BaseAdapter{
private Date[] calendarGrid;
private Context mContext;
private LayoutInflater inflater;
private static Calendar mCal;   
private String today;
SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy");

public CalendarAdapter(Context context){
    mContext = context;
    inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    mCal = Calendar.getInstance();
    CalendarView.dateStore.clear();
    initCalendar(mCal);     
}   
private void initCalendar(Calendar cal){

    Calendar c = Calendar.getInstance();
    c.setTime(cal.getTime());
    c.set(c.get(Calendar.YEAR), c.get(Calendar.MONTH), 1);

    int startOfWeek = c.get(Calendar.DAY_OF_WEEK);
    Log.e("fdfdfdf",""+startOfWeek);
    Log.e("-1 vagar nu",""+c.get(Calendar.DAY_OF_WEEK));

    c.add(Calendar.DATE, -startOfWeek);

    calendarGrid = new Date[6 * 7];
    int gridCount = 0;
    for (int week = 0; week < 6; week++) {
        for (int day = 0; day < 7; day++) {
            Date dt = c.getTime();
            dt.setHours(0);
            dt.setMinutes(0);
            dt.setSeconds(0);
            calendarGrid[gridCount++] = dt;
            c.add(Calendar.DATE, 1);
            }
        }
    }

public void nextMonth() {

    mCal.set(mCal.get(Calendar.YEAR), mCal.get(Calendar.MONTH) + 1, mCal.get(Calendar.DATE));
    initCalendar(mCal);
    notifyDataSetChanged();
}

public void prevMonth() {

    mCal.set(mCal.get(Calendar.YEAR), mCal.get(Calendar.MONTH) - 1, mCal.get(Calendar.DATE));
    initCalendar(mCal);
    notifyDataSetChanged();
}

public Calendar getCurrentCalendar() {
    return mCal;
}

@Override
public int getCount() {
    return calendarGrid.length;
}

@Override
public Date getItem(int position) {
    return calendarGrid[position];
}

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

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

    if (convertView == null) {

        holder = new ViewHolder();
        convertView = inflater.inflate(R.layout.raw_my_calendar, null);
        holder.txtDate = (TextView) convertView.findViewById(R.id.txtCalDate);
        holder.txtEventCount = (TextView) convertView.findViewById(R.id.txtEventCount);
        convertView.setTag(holder);

    }else{
        holder = (ViewHolder) convertView.getTag();
    }
    Date date = getItem(position);

    holder.txtDate.setText(String.format("%2d", date.getDate()));
    holder.txtDate.setTag(format.format(date).toString());
    String keyDate = DateUtils.formatDate(DateUtils.DB_DATE_FORMAT, date);
    setStyle(keyDate, position, holder.txtDate, convertView);

    if(CalendarView.dateStore.size()>= position+1){

        Log.d(" Calender Adapter "," Clear arrayList ****  "+CalendarView.dateStore.size());
        CalendarView.dateStore.clear();         
    }       
    CalendarView.dateStore.add(format.format(date).toString());     
    return convertView;
}

private void setStyle(String dateKey, int position, TextView txt, View convertView){

    if (dateKey.equals(today))
        convertView.setBackgroundColor(Color.parseColor("#88D23218"));
    else
        convertView.setBackgroundColor(Color.parseColor("#88CCCCCC"));

    if (getItem(position).getMonth() != mCal.get(Calendar.MONTH))
        txt.setTextColor(Color.parseColor("#FF787878"));
    else

        txt.setTextColor(Color.parseColor("#FF000000"));

        if(DaliyScreenActivity.month_member_id_arr.contains(txt.getText().toString())){             

            convertView.setBackgroundColor(Color.YELLOW);
            convertView.setBackgroundColor(android.graphics.Color.rgb(230, 187, 60));               
        }       
    }   
static class ViewHolder {
    TextView txtDate;
    TextView txtEventCount;
}

}

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:12:17+00:00Added an answer on June 11, 2026 at 3:12 am

    In your getView method …Change your last if..else

    to this,

     if (getItem(position).getMonth() != mCal.get(Calendar.MONTH))
     {
            txt.setTextColor(Color.parseColor("#FF787878"));
     }
     else
     {
            txt.setTextColor(Color.parseColor("#FF000000"));
    
              if(DaliyScreenActivity.month_member_id_arr.contains(txt.getText().toString())){             
    
                convertView.setBackgroundColor(Color.YELLOW);
                convertView.setBackgroundColor(android.graphics.Color.rgb(230, 187, 60));               
            }       
     }
    

    I mean to say keep your code to change background to Yellow in the else part.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to load the image URL from my NSMutableArray. Here is my Code:
I want to download and show some images inside gridView adapter. Here is my
Here is image of my problem: http://i48.tinypic.com/2roszr9.jpg . I want to ask you if
I have a image here http://power.itp.ac.cn/~jmyang/funny/fun4.jpg and I want to display it in my
Please look at this image here is 3 tables , and out i want
I have a simple image gallery here . All I want to do is
Placing an image inside a Span (here : HtmlGenericControl ) programmatically Want to have
Here is my php that retrieves image from mysql database. I want to resize
I want to have a UIImage as a background image on a UIView. Here
like 1 image says more than 1000 words. here is what I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.