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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T21:32:38+00:00 2026-06-10T21:32:38+00:00

everyone I am encountering a problem with passing the date from the calendar to

  • 0

everyone I am encountering a problem with passing the date from the calendar to my Create_Event.class. Initially the date textView displays “text” then when I click the “Select the date” button the calendar page will show and the date is supposed to be passed to textView that originally displays “text”. I tried coding using intent.putExtra to pass the date from the calendar page to the Create_Events page but I got a force close error due to NullPointerException. Can anyone help me with this issue? Thanks a lot.

For reference, the codes:

Calendar.java

@Override
                public void onClick(View view)
                {
                    String date_month_year = (String)view.getTag();
                    selectedDayMonthYearButton.setText(new StringBuilder().append("Selected:").append(date_month_year));

                    Intent k = new Intent(Calendar_Event.this, Create_Events.class);
                    k.putExtra("passdate", date_month_year);
                 startActivity(k);

Create_Event.java

 Intent intent = this.getIntent();
        if(intent == null)
        {
         String strdata = intent.getExtras().getString("passdate");
         TextView txtDate = (TextView) findViewById(R.id.textDate);
         txtDate.setText(strdata);
         }
        else
        {

        }

***Originally the if(intent == null) is if(intent != null), I thought changing it would work but it doesn’t. 😛

Updated the logcat:

09-07 12:03:28.177: E/AndroidRuntime(1033): FATAL EXCEPTION: main
09-07 12:03:28.177: E/AndroidRuntime(1033): java.lang.RuntimeException: Unable to start activity ComponentInfo{main.page/main.page.Create_Events}: java.lang.NullPointerException
09-07 12:03:28.177: E/AndroidRuntime(1033):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
09-07 12:03:28.177: E/AndroidRuntime(1033):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
09-07 12:03:28.177: E/AndroidRuntime(1033):     at android.app.ActivityThread.access$600(ActivityThread.java:123)
09-07 12:03:28.177: E/AndroidRuntime(1033):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
09-07 12:03:28.177: E/AndroidRuntime(1033):     at android.os.Handler.dispatchMessage(Handler.java:99)
09-07 12:03:28.177: E/AndroidRuntime(1033):     at android.os.Looper.loop(Looper.java:137)
09-07 12:03:28.177: E/AndroidRuntime(1033):     at android.app.ActivityThread.main(ActivityThread.java:4424)
09-07 12:03:28.177: E/AndroidRuntime(1033):     at java.lang.reflect.Method.invokeNative(Native Method)
09-07 12:03:28.177: E/AndroidRuntime(1033):     at java.lang.reflect.Method.invoke(Method.java:511)
09-07 12:03:28.177: E/AndroidRuntime(1033):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-07 12:03:28.177: E/AndroidRuntime(1033):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-07 12:03:28.177: E/AndroidRuntime(1033):     at dalvik.system.NativeStart.main(Native Method)
09-07 12:03:28.177: E/AndroidRuntime(1033): Caused by: java.lang.NullPointerException
09-07 12:03:28.177: E/AndroidRuntime(1033):     at main.page.Create_Events.onCreate(Create_Events.java:261)
09-07 12:03:28.177: E/AndroidRuntime(1033):     at android.app.Activity.performCreate(Activity.java:4465)
09-07 12:03:28.177: E/AndroidRuntime(1033):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
09-07 12:03:28.177: E/AndroidRuntime(1033):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)

enter image description here enter image description here

Any help would be greatly appreciated! Thanks again.

Updated:

 Bundle bundle = getIntent().getExtras();  
    if(bundle != null)
    {

        String date = bundle.getString("date");
        TextView txtDate = (TextView) findViewById(R.id.textDate);
        txtDate.setText(date);          
    }
  • 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-10T21:32:40+00:00Added an answer on June 10, 2026 at 9:32 pm

    Use Bundle in Create_Events Activity to get date. Before passing data you first need to check it is null or not.

    Bundle bundle = getIntent().getExtras();
    
    if(bundle != null)
    {
        String date = bundle.getString("passdate");
    }
    

    Bundle generally use for passing data between various Activities. It
    depends on you what type of values you want to pass but bundle can
    hold all types of values and pass to the new activity.

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

Sidebar

Related Questions

everyone. This is a piece of code from using sqlite in android tutorial: return
Everyone knows the = sign. SELECT * FROM mytable WHERE column1 = column2; However,
Everyone at Class too big and hard to add new features is completely unphased
everyone The problem is if there exists two exported components which have the same
Everyone knows that Java supports data hiding. I went for an interview. Then interviewer
Everyone knows public class Test<T> where T : SomeBaseClass But is there a way
everyone I got problem here I need to update a plist data in a
everyone, i found this strange problem ( maybe it is a feature ) this
everyone , I have a problem about the API-- alSourceUnqueueBuffers when I use the
everyone. I have problem replacing existing rows in table with new ones. I use

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.