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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:18:26+00:00 2026-06-09T15:18:26+00:00

I am trying to start a new activity when you click on a date

  • 0

I am trying to start a new activity when you click on a date in CalendarView but my event doesn’t seem to fire. I have set clickable to true and specified an onclick (both in xml)

this is the xml:

     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent" >

     <CalendarView
     android:id="@+id/calendarView1"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:layout_alignParentLeft="true"
     android:layout_alignParentTop="true"
     android:clickable="true"      
     android:onClick="CalendarClick" />

     </RelativeLayout>

this is my code for the calendar activity:

    public class CalendarActivity extends Activity 
    {


      @Override
      public void onCreate(Bundle savedInstanceState) 
      {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_calendar);
      }

     @Override
     public boolean onCreateOptionsMenu(Menu menu) 
     {
      getMenuInflater().inflate(R.menu.activity_calendar, menu);
      return true;
     }

     public void CalendarClick(View view)
     {
      Intent myIntent = new Intent(CalendarActivity.this, MainActivity.class);
      CalendarActivity.this.startActivity(myIntent);
     }      
  }
  • 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-09T15:18:27+00:00Added an answer on June 9, 2026 at 3:18 pm

    This works fine…..

     public class MyActivity extends Activity{
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
             setContentView(R.layout.newact);
            CalendarView calendarView=(CalendarView) findViewById(R.id.calendarView1);
            calendarView.setOnDateChangeListener(new OnDateChangeListener() {
    
                @Override
                public void onSelectedDayChange(CalendarView view, int year, int month,
                        int dayOfMonth) {
                     Toast.makeText(getApplicationContext(), ""+dayOfMonth, 0).show();// TODO Auto-generated method stub
    
                }
            });
        }
    

    And this is xml

    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    
        <CalendarView
            android:id="@+id/calendarView1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"  
            />
    
    </RelativeLayout>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to start new activity by button click. Main Activity code: public class
I am trying to start a new Rails project but I am getting a
I am trying to close a memcached connection to start a new one. But
I'm trying to start a new Activity from a PreferenceActivity. However, it fails with
I'm trying to start an Activity in my AsyncTask from the doInBackground() method but
Hi ive got a custom listview and im trying to start a new activity
I'm new on Android, and I'm trying to start an Activity from a MenuItem
Im trying to debug my menu activity but it cant seem to display the
I'm trying to create an intent to a new activity on an application but
I'm trying to start a new ASP.NET Web Application Project using Visual Studio 2008.

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.