Skip to content

Instantly share code, notes, and snippets.

Avatar

Ricardo Vieira rjsvieira

  • Kelvin Inc
  • Portugal
View GitHub Profile
@rjsvieira
rjsvieira / DialogFragmentCallback.md
Created Mar 26, 2018 — forked from Joev-/DialogFragmentCallback.md
Getting results from DialogFragment to calling Fragment using Callbacks
View DialogFragmentCallback.md

##Getting results from DialogFragments to another Fragment.

When setting up the DialogFragment make a call to Fragment.setTargetFragment()
Then from DialogFragment you can access the main fragment with Fragment.getTargetFragment()
Use interfaces to provide the required actions to the calling Fragment.

##Example code.

###AddFriendDialogFragment - Calls back to calling fragment.

@rjsvieira
rjsvieira / gist:d93cead0e02faec716f1723a6d1dcfce
Created Mar 5, 2018 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
View gist:d93cead0e02faec716f1723a6d1dcfce
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote