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 6851983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:18:56+00:00 2026-05-27T01:18:56+00:00

Hi i am developing android application. Now at this stage i am developing calendar

  • 0

enter image description hereHi i am developing android application. Now at this stage i am developing calendar which is in week view. For doing that i have use grid view.In grid view there is 7 columns per week days. Each column have one textview which display name of the week day.Now i want to display different week days in each column.But I don’t know how to achieve this as i am new in this field. i am using custom adapter for this.Here is code Any help is appreciated.
Here on 6 in want to display Name of week days.

  • 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-05-27T01:18:56+00:00Added an answer on May 27, 2026 at 1:18 am
    package com.gridlayoutdemo;
    
    import java.util.Calendar;
    import java.util.GregorianCalendar;
    
    import android.app.Activity;
    import android.content.Context;
    import android.os.Bundle;
    import android.view.LayoutInflater;
    import android.view.View;
    import android.view.View.OnClickListener;
    import android.view.ViewGroup;
    import android.widget.BaseAdapter;
    import android.widget.GridView;
    import android.widget.ImageView;
    import android.widget.TableRow.LayoutParams;
    import android.widget.TextView;
    
    public class GridLayoutDemo extends Activity {
        /** Called when the activity is first created. */
    
       public String[] weekdays={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}; 
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
    
            GridView gridview = (GridView) findViewById(R.id.gridview); 
            gridview.setAdapter(new MyAdapter(this)); 
        }
    }
    
    class MyAdapter extends BaseAdapter { 
         Context context;
    
        public MyAdapter(Context context) {
            this.context = context;
        }
    
        public int getCount() {
            return 7;
        }
    
        public Object getItem(int position) {
            return null;
        }
    
        public long getItemId(int position) {
            return 0;
        }
    
        public View getView(int position, View convertView, ViewGroup parent) {
    
            ViewHolder holder;
            if (convertView == null) {
                LayoutInflater li = LayoutInflater.from(context);
                convertView = li.inflate(R.layout.main1, null);
                holder = new ViewHolder();
    
    
                holder. tvWeekDay = (TextView)convertView.findViewById(R.id.tvWeekDayName);
                    Calendar c = Calendar.getInstance();
                    System.out.println(c.get(Calendar.DAY_OF_WEEK));
    
                     holder.tvWeekDay.setText(weekdays[position]);
                    }
                }
                // holder.tvWeekDay.setText(Integer.toString(Calendar.MONTH));
    
                TextView tvDate = (TextView)convertView.findViewById(R.id.tvDate);
                TextView tvNotes = (TextView)convertView.findViewById(R.id.tvNotes1);
                convertView.setTag(holder);
    
                //tvWeekday.setText(c.get(Calendar.MONTH));
                tvNotes.setText(" Click here for new Note");
                tvNotes.setTextSize(10);
                tvNotes.setOnClickListener(new OnClickListener() {
    
                    @Override
                    public void onClick(View v) {
                        System.out.println(" Click is successful");
                    }
                });
    
                TextView tv2 = (TextView)convertView.findViewById(R.id.tvNotes2);
                tv2.setText(" Click here for new Note" );
                tv2.setTextSize(10);
                tv2.setLayoutParams(new LayoutParams(140, 200));
    
                tv2.setOnClickListener(new OnClickListener() {
    
                    @Override
                    public void onClick(View v) {
                        System.out.println("1.Click is successful");
                    }
                });
            }
            else {
                holder = (ViewHolder) convertView.getTag();
            }
            Calendar c = Calendar.getInstance();
            System.out.println(c.get(Calendar.DAY_OF_WEEK));
    
            return convertView;
        } 
        static class ViewHolder {
              TextView tvWeekDay;
         }
    }
    
    //main1.xml
    
    
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent">
    
    
            <LinearLayout android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:id="@+id/LlHeader"
            android:background="@drawable/calendar_top_header">
    
                    <TextView 
                        android:id="@+id/tvWeekDayName"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" 
                        android:textStyle="bold"
                        android:layout_marginLeft="5dp"
                        android:singleLine="true" 
                        android:textColor="#FFFFFF"
                        android:text="Friday"/>
    
                    <TextView 
                        android:id="@+id/tvDate"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginLeft="5dp" 
                        android:textStyle="bold"
                        android:layout_marginBottom="5dp"
                        android:singleLine="true" 
                        android:textColor="#FFFFFF"
                        android:text="25-NOV-2011"/>
            </LinearLayout>
    
        <TextView  android:id="@+id/tvNotes1" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content">
        </TextView>
    
        <TextView  android:id="@+id/tvNotes2" 
            android:layout_width="wrap_content" 
            android:layout_height="wrap_content">
        </TextView>
    
    </LinearLayout>
    
    
    //main.xml
    
    
    
    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"  
        android:orientation="vertical"
        android:background="#f5f5f5"
        android:layout_height="fill_parent">
        <LinearLayout android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="5dp"
            android:orientation="horizontal"
            android:background="@drawable/calendar_top_header">
    
                    <ImageView
                        android:id="@+id/imgleftarrow"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" 
                        android:src = "@drawable/cal_left_arrow_off">
                    </ImageView>
                    <TextView 
                        android:id="@+id/tvMonthName"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content" 
                        android:textStyle="bold"
                        android:layout_marginTop="5dp"
                        android:layout_marginLeft="80dp"
                        android:singleLine="true" 
                        android:textColor="#FFFFFF"
                        android:text="November"/>
                     <ImageView
                        android:id="@+id/imgrightarrow"
                        android:layout_width="wrap_content"
                        android:layout_marginLeft="95dp"
                        android:layout_height="wrap_content" 
                        android:src = "@drawable/cal_right_arrow_off">
                    </ImageView>
    
            <!--     </LinearLayout> -->
            </LinearLayout>
    
    
    <GridView 
        android:id="@+id/gridview" 
        android:layout_width="fill_parent"  
        android:numColumns="2" 
        android:layout_height="fill_parent"
        android:background="#f5f5f5" 
         />
    </LinearLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an android application. Now i have created one function which create
Hi i am developing android application, And now i have to use sqlite database
I am developing Android Application. In which i am having list view with text
Background I am developing an application for android in eclipse and now I have
I'm currently developing an application for Android which needs to use a custom made
I'm now to android. And I'm having trouble in developing application in which I'm
Hi i am developing android application. I that i have creating the dynamic table
I am developing an android application in which I have to upload image from
I'm currently developing an Android application that fetches images using http requests. It would
We've been developing an Android application which includes Google Adsense. However there seems 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.