Proper way to get context of parent activity inside fragment fragment (android)

view story

http://stackoverflow.com – Hi I am developing small android application and in my application I am using fragment concept. In my one activity I am using multiple fragments and doing transitions of those fragment. Now Inside one fragment I am displaying one alert dialog and for i need to pass context of activity. I did this in this following manner. new AlertDialog.Builder(getSherlockActivity()) .setTitle("Logout") .setMessage("Really Logout from App?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, (HowTos)