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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:42:47+00:00 2026-06-16T00:42:47+00:00

Please I get a NullPoiterException when I try to get the extras form the

  • 0

Please I get a NullPoiterException when I try to get the extras form the intent.
The error is thrown exactly when I call

int posizione2 =Integer.parseInt((getIntent().getExtras().getString(Intent.EXTRA_TEXT)));

Any help very much appreciated!

private void aggiungiImm(View arg1, int arg2) {
    Intent i=newintent(Intent.ACTION_PICK,ContactsContract.Contacts.CONTENT_URI);
    i.putExtra(Intent.EXTRA_TEXT, Integer.toString(arg2));
    startActivityForResult(i, PICK_REQUEST);    
}    

@Override
protected void onActivityResult(int requestCode, int resultCode,Intent data) {
    Uri contactData=null;
    if (requestCode==PICK_REQUEST) {
    if (resultCode==RESULT_OK) {
    contactData=data.getData();                     
    int posizione2 =Integer.parseInt((getIntent().getExtras().getString(Intent.EXTRA_TEXT)));

EDITED:
No solution so far.
Can it be that the problem is related to the fact that this is an Implicit Intent??

  • 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-16T00:42:48+00:00Added an answer on June 16, 2026 at 12:42 am

    instead of

    int posizione2 =Integer.parseInt((getIntent().getExtras().getString(Intent.EXTRA_TEXT)));
    

    Try that:

    Bundle extras = getIntent().getExtras();
    if (extras==null) {
      Log.e( "", "No extras provided" );
      return;
    }
    
    String myText = extras.getString(Intent.EXTRA_TEXT);
    if (myText==null) {
      Log.e( "", "No text provided" );
      return;
    }
    
    int posizione2 = Integer.parseInt(myText);
    

    Should help you to see what is giving the exception…

    By the way, your returned text (if that text is comming as result from the other activity) will be available in the Intent passed to the function. So you should be doing:

    if (data.getString(Intent.EXTRA_TEXT)==null) {
      Log.e( "", "No text provided" );
      return;
    }
    
    int posizione2 = Integer.parseInt(data.getString(Intent.EXTRA_TEXT));
    

    The getIntent() method will give you the intent with which the calling activity had been started. No the intent holding the result of the called activity.

    If you are getting the No text provided message, that means you have not properly returned the result in the activity that computes it.

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

Sidebar

Related Questions

Please help with the following error that I get with Spring Security 3.05 and
I get an error whenever I try to create a simple edge from a
please can anyone tell me the error ! i get error in the line
Please refer to Get PDF hyperlinks on iOS with Quartz It explained an algorithm
Could somebody please help me get Clang up and running? (I don't have 3.2)
I get the message Please wait while Windows configures Microsoft Visual Studio 2008... whenever
please tell me how to get and bind data to UltraGrid dynamically on each
Please suggest how to get the IP address of my system (logical address) using
Please tell me how can I get array of all Those DIV of specific
Please let me know how to get the client IP address, I have tried

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.