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

  • Home
  • SEARCH
  • 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 8565605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:27:50+00:00 2026-06-11T17:27:50+00:00

HI i am getting null pointer exception while sending image path to another activity

  • 0

HI i am getting null pointer exception while sending image path to another activity

here is below my code

public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
        System.out.println(requestCode + ",      " + resultCode);
        if (requestCode == SELECT_PICTURE) {

            if (data.getData() != null) {
                    Uri selectedImageUri = data.getData();
                    String path = getPath(selectedImageUri);
                    System.out.println("PATH  =  "+path);
                    Intent _intent = new Intent(MainActivity.this,AndroidFaceDetector.class);
                    _intent.putExtra("mypath", path);
                    startActivityForResult(_intent, CROPPED_FACE_IMAGE);
            }
            else
            {
                Toast.makeText(MainActivity.this, "Please try again", Toast.LENGTH_SHORT).show();
            }
        }
        else {
            setImage(data);
        }

    }
}

Now in AndroidFaceDetector class

     @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(new myView(this));
    Intent _intent = getIntent();
    path = _intent.getStringExtra("mypath");
    System.out.println("Path is gettting "+path); //here i am getting null value
}

because

here i am getting path value null.. can any body solve this problem….

  • 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-11T17:27:52+00:00Added an answer on June 11, 2026 at 5:27 pm

    try like this in Second Activity

            Intent myintent = getIntent();
            if(null != myintent.getExtras())
            {
                  // do your work here 
            String path = myintent.getExtras().getString("mypath");          
            }
            else
            {
                  // not here you can't get values
                   Toast.makeText(getApplicationContext(),"No Recor Here..",12).show();    
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Iam getting a null pointer exception while sending some string text as an sms
Hi i am getting a null pointer exception while running my application.. Here is
I am getting NULL pointer exception currently, when I run this thread public void
Why am i getting this null pointer exception. Here is my code I am
i'm getting a weird null pointer exception in the last line of this code:
I am getting null pointer exception while trying to add anything in my solrQueue.
I am getting same null pointer exception while running integration test in eclipse .while
I'm getting a Null Pointer Exception while in executing a macro to do some
I am getting a NullPointerException while creating a TreeMap. Here is my code: public
im getting sometimes null pointer exception while accessing handler created in thread. I`m using

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.