Questions tagged [onactivityresult]

Called when an activity you launched exits, giving you the requestCode you started it with, the resultCode it returned, and any additional data from it. The resultCode will be RESULT_CANCELED if the activity explicitly returned that, didn't return any result, or crashed during its operation.

Called when an activity you launched exits, giving you the requestCode you started it with, the resultCode it returned, and any additional data from it. The resultCode will be RESULT_CANCELED if the activity explicitly returned that, didn't return any result, or crashed during its operation.

You will receive this call immediately before onResume() when your activity is re-starting.

Click Here for Google Android Documentation

990 questions
9
votes
4 answers

Android: setResult not returning result to Parent Activity

I have started a child activity from parent activity using startActivityForResult. After performing required functions in child activity I am setting result using setResult. But I am not getting result at parent activity from child activity. Heres…
9
votes
4 answers

onActivityResult doesn't call from viewPager fragment

Hi I am using viewPager with fragmnets inside main fragment. I am trying to get image to bitmap from gallery or from camera, but after picking photo and startActivityForResult it doesn't catch in onActivityResult... here is how i call…
7
votes
1 answer

android - using same fragment for multiple activities

I want to use a fragment in multiple activities. In the first activity i will use it in, I created it by final ScoreBoard fragment = new ScoreBoard(); getFragmentManager() .beginTransaction() …
7
votes
3 answers

super.onActivityResult inside adapter class? Android

I have RecyclerView with very complex item, multiple buttons/images/texts. To access each button/image I set my click Listeners inside my Adapter class. But now I am trying add function to set contact ringtone and I have a problem. I am calling the…
Slim C.
  • 1,119
  • 4
  • 25
  • 49
7
votes
2 answers

Passing onActivityResult in Cordova

Does Cordova have any automatic way to pass onActivityResult to its CordovaPlugin classes? Here's my current file, doing it manually: package com.myapp; import android.os.Bundle; import org.apache.cordova.*; import android.content.Intent; import…
Agamemnus
  • 1,395
  • 4
  • 17
  • 41
7
votes
0 answers

How can I use createPendingResult inside fragment?

I have a user dialog which is created from a fragment. The user can make a choice and I want this choice to be delivered to fragment's onActivityResult. To do so, I use createPendingResult. This method works fine for an activity, but for a fragment…
Couitchy
  • 1,079
  • 10
  • 15
7
votes
1 answer

onActivityResult method is not being called

I'm having a problem in my android application. I don't know why 'onActivityResult' method is not being called when 'Up navigation' button from action bar is pressed. I think I've done everything properly: Parent activity launch child activity with…
Eduardo
  • 1,169
  • 5
  • 21
  • 56
6
votes
1 answer

Android activity lifecycle

What is called first when activity is restored? onRestoreInstanceState or onActivityResult?
6
votes
3 answers

Passing Multiple Mime Types to ActivityResultLauncher.launch()

I have following code val getContent = registerForActivityResult(ActivityResultContracts.GetContent()) { uri: Uri? -> //Some code here.. } and somewhere else…
6
votes
2 answers

AndroidResultContracts.TakePicture() returns Boolean instead of Bitmap

The contract has been changed to return Boolean instead of Bitmap starting in androidx.activity version 1.2.0-alpha05. How can I use the Boolean returned by the built in AndroidResultContracts.TakePicture() contract to access and display the photo…
Sampson
  • 662
  • 6
  • 17
6
votes
1 answer

Android P onStart called before onActivityResult

I am trying the new Android P Developer Preview, and the secenario is as follows: I call Activity B from Activity A with startActivityForResult Finish Activity B with SetResult and go back to Activity A, the Activity Life cycle used to be (Prior…
6
votes
0 answers

Different behaviour for onActivityResult in DialogFragment in Android O

I've noticed a difference between Android 7 (and before) and Android 8 (beta) when calling startActivityForResult from a DialogFragment. In MainActivity below, when 'OK' is pressed on the dialog, it dismisses itself, creates and shows a new dialog,…
6
votes
3 answers

onActivityResult Intent is null when passing Intent from Adapter

I am facing a strange issue while returning to an Activity with a Result, I am passing an Intent for startActivityForResult from an Adapter like this : Intent i = new Intent(activity, EditInfoActivity.class); i.putExtra("id",…
Kapil Rajput
  • 11,429
  • 9
  • 50
  • 65
6
votes
3 answers

How to use onActivityResult in another class

I want to use onActivityResult in a class which not extends activity but this class has a global variable as an instance of activity. This class is similar to this : public class myClass(){ public Activity myActivity; . . . // I…
Payam Roozbahani
  • 1,225
  • 15
  • 27
6
votes
3 answers

Identify in onActivityResult if image was selected from gallery or video was selected - Android

I am using following code to select a image or video from gallery : imgGallery.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent pickPhoto = new…
rahul
  • 1,095
  • 8
  • 22
1 2
3
65 66