Android: Error using calling AlertDialog from inside Fragment

view story

http://stackoverflow.com – Why do i always get error when i try to call AlertDialog from my fragment? At first i try to put it in OnCreate but it also get the same error log... MainFragment.java public class MainFragment extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_fragment); if (savedInstanceState == null) { FragmentTransaction ft = getFragmentManager().beginTransaction(); LoginFragment fragment = new LoginFragment(); ft.add(R.id.simple_fragment, f (HowTos)