Skip to content

Instantly share code, notes, and snippets.

View rjsvieira's full-sized avatar

Ricardo Vieira rjsvieira

View GitHub Profile
@rjsvieira
rjsvieira / DialogFragmentCallback.md
Created March 26, 2018 17:37 — forked from Joev-/DialogFragmentCallback.md
Getting results from DialogFragment to calling Fragment using Callbacks

##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 March 5, 2018 14:03 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
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