Added helper method createDialog in TextFragments

create dialog prevents repeating of code in onOptionsItemSelected
method.