The method getApplicationContext() is undefined - fragment issues

Change

Intent intent = new Intent(getApplicationContext(), LoginActivity.class);

to

Intent intent = new Intent(getActivity(), LoginActivity.class);

You can get the activity that contains the fragment with getActivity().

Therefore getActivity().getApplicationContext() would work.

getActivity().findViewById(int) would also work.

Make sure, though, you don't use getActivity() prior to onActivityCreated(), since it would return null prior to that.