Questions tagged [onnewintent]

protected method in android.app.Activity class

onNewIntent(Intent) is a protected method in android.app.Activity class and this is called for activities that set launchMode to "singleTop" in their package, or if a client used the FLAG_ACTIVITY_SINGLE_TOP flag when calling startActivity(Intent).

55 questions
0
votes
1 answer

Get intent from Android onNewIntent on later timing

Is it possible to retrieve the Intent which came in onNewIntent on a later timing? For example, lets assume that I have a LiveData Observer in my Activity or Fragment, and when onChange is called I want to check if there was a new Intent earlier,…
Moti Bartov
  • 3,454
  • 33
  • 42
0
votes
1 answer

Android Jetpack Navigation does not update onNewIntent/onCreate intent extra data to the destinations

I have an activity with NavHost composable calling a simple composable function with a TextField set as start destination. There is a ViewModel that stores that text field text state in MutableState object. This activity receives…
0
votes
0 answers

onNewIntent method is never called when an NFC tag is detected

I am currently developing an Android NFC application. This application contains a NavigationDrawer in which I can access 3 different fragments which each correspond to 3 different NFC features. First, I want to verify that my application can scan an…
0
votes
1 answer

Pass data with PendingIntent and retrieve with onNewIntent when app launches

I have an Android application which will receive push notification. The notification have wearable support hence the notification will also be visible in Android wear with action button. I am looking to pass data when the notification reaches…
0
votes
0 answers

Persistable permissions for content uri received via onNewIntent

I want to gain persistent read access to files received via onNewIntent(): public void onNewIntent(Intent intent) { Uri uri = getIntent().getData(); getContentResolver().takePersistableUriPermission(uri,…
Hyndrix
  • 4,282
  • 7
  • 41
  • 82
0
votes
1 answer

onNew intent returns old data

I am having a notification screen .When notification receives and i tap on notification it will navigate to particular screen.The issue is when i am in the notification screen and i am getting a new notification the on new intent is returning old…
Sujiz
  • 1,720
  • 1
  • 20
  • 30
0
votes
2 answers

How to stop my activity from opening another instance in another application from share menu?

I have my application that allows other apps that can share files to select it on the share menu, open the application up and "transfer" the files over to my app. My problem is when they select my application from the share menu (as example, in…
Brandon
  • 1,158
  • 3
  • 12
  • 22
0
votes
0 answers

call onNewIntent get view null pointer exception

My Activity launch model: singleTop in onCreate: mTabIcon = findViewById(R.id.m_tab_icon); in onNewIntent: mTabIcon.setSelected(true); but occur NullPointerException: Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'void…
0
votes
1 answer

onNewIntent never being called in Activity

I have asked multiple questions on SO regarding different problems I am having with onNewIntent method in both fragments and activities. My problem now is that onNewIntent in Activity is never being called no matter what I do. The Activity that has…
DaGuy
  • 65
  • 1
  • 6
0
votes
1 answer

how to make OnNewIntent work inside tabs

I am working on a project where I have 3 tabs. The first tab is used to write information to NFC tag where the other 2 tabs are used to read the information from the NFC tag. However, I am facing a problem with OnNewIntent() method. As I understood…
DaGuy
  • 65
  • 1
  • 6
0
votes
1 answer

Keep instance of Home Activity when launched

So, my app has 5 activities: A, B, C, D, E. A is the splash (launcher) activity and never gets called again after launch. After launching, B gets called and serves as the Home activity. B, C, D, E all get called with…
seekingStillness
  • 4,833
  • 5
  • 38
  • 68
0
votes
0 answers

creating multiple instances of the same activity

So I've been looking everywhere to try to allow my app to have a new instance of an activity whenever I want "onCreate" but I haven't found much to help me. I understand that you can use launchMode="singleTop" so you can force everything to be a…
DrBrad
  • 163
  • 2
  • 12
0
votes
0 answers

Android - onNewIntent - fragments

Which is the best way to handle a bundle with comes at onNewIntent method? This arrow -> means push fragment. I have the following scenario: ActivityA -> FragmentA -> FragmentB -> I go background -> I receive a push notfication -> User clicks on…
Ricardo
  • 7,921
  • 14
  • 64
  • 111
0
votes
2 answers

How to use onNewIntent in non activity class

this question may seem kinda broad but i'm sure once you've read up, the context will become clear. I need to write a class that doesn't extend activity but i want it to be able to run onNewIntent Method. The reason for this is because the class…
user7265075
0
votes
1 answer

How can I put this method in a fragment?

I took this method from an activity. How can I add in a Fragment? @Override protected void onNewIntent(Intent intent) { setIntent(intent); readFromIntent(intent); if(NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())){ …