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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:07:59+00:00 2026-06-05T14:07:59+00:00

In my activity’s onNewIntent() method, getIntent().getData(); is always null. It definitely goes to this

  • 0

In my activity’s onNewIntent() method, getIntent().getData(); is always null. It definitely goes to this method before going to onCreate() or any other lifecycle function. It returns here from a browser, I don’t know why getIntent().getData() is null though.

this activity starts the browser like this context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(requestToken.getAuthenticationURL())));

and returns here

@Override
public void onNewIntent(Intent intent){
    super.onNewIntent(intent);

    Uri uri = getIntent().getData();
    if (uri != null && uri.toString().startsWith(TwitterConstants.CALLBACK_URL)) {...}
}

but uri is always null.

manifest stuff:

  <activity
        android:name="myapp.mypackage.TweetFormActivity"
        android:configChanges="orientation|keyboardHidden"
        android:label="@string/app_name"
        android:launchMode="singleInstance"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Black.NoTitleBar">
         <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="oauth" android:host="myapp"/>
        </intent-filter>
        </activity>

static final String CALLBACK_URL = "oauth://myapp";

what am I missing here? thanks

  • 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-05T14:08:02+00:00Added an answer on June 5, 2026 at 2:08 pm

    You should call getData() for the intent argument or perform setIntent(intent) before obtaining URI. onNewIntent() doesn’t set new intent automatically.

    UPDATE: So, here’re two ways that you can implement onNewIntent(). The first replaces the old intent with the new one, so when you call getIntent() later, you will receive the new intent.

    @Override
    protected void onNewIntent(final Intent intent) {
        super.onNewIntent(intent);
        // Here we're replacing the old intent with the new one.
        setIntent(intent);
        // Now we can call getIntent() and receive the new intent.
        final Uri uri = getIntent().getData();
        // Do something with the URI...
    }
    

    The second way is to use data from the new intent leave the old one as-is.

    @Override
    protected void onNewIntent(final Intent intent) {
        super.onNewIntent(intent);
        // We do not call setIntent() with the new intent,
        // so we have to retrieve URI from the intent argument.
        final Uri uri = intent.getData();
        // Do something with the URI...
    }
    

    Of course, you can use a combination of two variants, but do not expect to receive the new intent from getIntent() until you explicitly set it with setIntent().

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

Sidebar

Related Questions

In Activity lifecycle the onActivityResult method is called before the onCreate methode, where all
In Activity we have method @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); //... } My
The activity in the manifest is singleTask. The onNewIntent method is called when the
This activity is used for login. It post the username and password to a
my activity with a mapview crashes out randomly. I think all my potentially null
My activity has android:windowSoftInputMode=adjustResize and behaves accordingly in Android 2.1: Before soft keyboard appears
My activity's onInit() contains a call to TextToSpeech.setEngineByPackageName() : tts = new TextToSpeech(this, this);
In Activity class, there is method called registerForContextMenu(View view) . The android document explains
My Activity locks its orientation by using setRequestedOrientation(). However, once this is set to
My Activity needs to monitor the orientation of the device. Now this works great

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.