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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:18:56+00:00 2026-06-07T00:18:56+00:00

There are two intents on the receiver side which are called from the same

  • 0

There are two intents on the receiver side which are called from the same activity and are sending data to different activities. The second intent is not working. First one does. I cannot figure out why. All the activities and the manifest seems to be correct.

//second intent on senders side    
        public void onItemSelected(AdapterView<?> arg0, View users, int i,
                        long l) {
                    FILENAME = (adapter.getItem(i)).toString();

            Bundle viewBag2 = new Bundle();
                        viewBag2.putString("profile_name", FILENAME);
                        Intent b = new Intent(OptionsMenu.this, CoreActivity.class);
                        b.putExtras(viewBag2);  
                        startActivity(b);
              }


    //second intent on receiver side

        private void Data_transfer() {
        Bundle gotbasket2 = getIntent().getExtras();
                profileName = gotbasket2.getString("profile_name");
        }

    //first (working intent) on senders side
        public void onClick(View v) {
                    Bundle viewBag = new Bundle();
                    viewBag.putString("spinner_result", s);
    a.putExtras(viewBag);
    }



    //first (working intent) on receiver side
        private void Data_transfer() {
            // TODO Auto-generated method stub
            Bundle gotbasket = getIntent().getExtras();
            x = gotbasket.getString("spinner_result");
    }

Below is the logcat attached.

 06-26 20:22:09.787: D/AndroidRuntime(1802): Shutting down VM
    06-26 20:22:09.787: W/dalvikvm(1802): threadid=1: thread exiting with uncaught exception (group=0x40015560)
    06-26 20:22:09.847: E/AndroidRuntime(1802): FATAL EXCEPTION: main
    06-26 20:22:09.847: E/AndroidRuntime(1802): java.lang.RuntimeException: Unable to start activity ComponentInfo{mioc.diver/mioc.diver.CoreActivity}: java.lang.NullPointerException
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at android.os.Handler.dispatchMessage(Handler.java:99)
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at android.os.Looper.loop(Looper.java:123)
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at android.app.ActivityThread.main(ActivityThread.java:3683)
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at java.lang.reflect.Method.invokeNative(Native Method)
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at java.lang.reflect.Method.invoke(Method.java:507)
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at dalvik.system.NativeStart.main(Native Method)
    06-26 20:22:09.847: E/AndroidRuntime(1802): Caused by: java.lang.NullPointerException
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at mioc.diver.CoreActivity.Data_transfer(CoreActivity.java:189)
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at mioc.diver.CoreActivity.onCreate(CoreActivity.java:88)
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
    06-26 20:22:09.847: E/AndroidRuntime(1802):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
    06-26 20:22:09.847: E/AndroidRuntime(1802):     ... 11 more
  • 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-07T00:18:59+00:00Added an answer on June 7, 2026 at 12:18 am

    First of all, you don’t need to create a new bundle every time you want to put an extra into the intent. You can just do:

    Intent b = new Intent(OptionsMenu.this, CoreActivity.class);
    b.putExtra(key, value);
    

    Secondly, you shouldn’t start method name with an upper-case letter, as mentioned in the Google Java Style Guide.

    Finally, it seems you’re getting a NullPointerException in Data_transfer() which means that you have a null variable at line 189 of your Activity (probably FILENAME).

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

Sidebar

Related Questions

There are two project in which I collaborate, they live in different servers, A
I have two activities; Home is my first activity and Settings is my second
In my application there are two class one is InternetActivity which only extends Activity
I am creating an android application in which there are two activites. One activity
I just wonder whether there will be any conflict if two service intents are
There are two variables which are required in the tracking pixel which needs to
There are two tables Table 1 select * from manage_tcp; +----+----------+--------+ | id |
There are two ways to make a broadcast receiver known to the system: One
I have read a document that they say: In java there two types of
There are two table s : one is the master and one the detail

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.