question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Usage In Fragment

See original GitHub issue

I can`t able to use this in fragment

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

39reactions
ArthurHubcommented, May 24, 2016

you started the activity using .start(getActivity()); this way the result will only return in the activity, not in the fragment. If you use appcompat fragment (recomended) you can call .start(getContext(), this) otherwise you need to call .getIntent(getContext()) and then use this intent to start the activity from your fragment.

3reactions
ArthurHubcommented, May 23, 2016

from my tests it looks like everything works.

Just to be sure you are not missing something. you should override the onActivityResult of the fragment to receive the result and if you did override onActivityResult the result there will be received with different request code, so you must call super.onActivityResult(requestCode, resultCode, data); to pass the result to the fragment.

If this doesn’t answer you issue please provide more data than “not working”.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating and Using Fragments | CodePath Android Cliffnotes
A fragment is a reusable class implementing a portion of an activity. A Fragment typically defines a part of a user interface. Fragments...
Read more >
Fragments | Android Developers
Overview · Connect to the network · Manage network usage · Reading network state · Optimize network access · Optimize network data usage ......
Read more >
Fragment Tutorial With Example In Android Studio
In Android, Fragment is a part of an activity which enable more modular activity design. It will not be wrong if we say...
Read more >
Android - Fragments
First of all decide how many fragments you want to use in an activity. · Next based on number of fragments, create classes...
Read more >
Building dynamic user interfaces in Android with fragments
A fragment is an independent Android component which can be used by an activity. A fragment encapsulates functionality so that it is easier...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found