package de.wak_sh.client.fragments;

import java.io.IOException;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import de.wak_sh.client.R;
import de.wak_sh.client.backend.ProgressDialogTask;
import de.wak_sh.client.backend.model.UserInformation;
import de.wak_sh.client.backend.service.UserInformationService;

public class BenutzerinfoFragment extends Fragment {
	protected UserInformation userInformation;

	private TextView benutzername;
	private TextView studiengang;
	private TextView studiengruppe;
	private TextView matrikelnummer;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_benutzerinfo,
				container, false);

		benutzername = (TextView) rootView.findViewById(R.id.text_benutzername);
		studiengang = (TextView) rootView.findViewById(R.id.text_studiengang);
		studiengruppe = (TextView) rootView
				.findViewById(R.id.text_studiengruppe);
		matrikelnummer = (TextView) rootView
				.findViewById(R.id.text_matrikelnummer);

		return rootView;
	}

	@Override
	public void onAttach(Activity activity) {
		super.onAttach(activity);
		if (userInformation == null) {
			new UserInfoTask(activity).execute();
		}
	}

	private class UserInfoTask extends ProgressDialogTask<Void, Void> {
		public UserInfoTask(Context context) {
			super(context, context.getString(R.string.fetching_user_info));
		}

		@Override
		protected Void doInBackground(Void... params) {
			try {
				userInformation = new UserInformationService()
						.getUserInformation();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
				return null;
			}

			getActivity().runOnUiThread(new Runnable() {
				@Override
				public void run() {
					benutzername.setText(userInformation.getBenutzername());
					studiengang.setText(userInformation.getStudiengang());
					studiengruppe.setText(userInformation.getStudiengruppe());
					matrikelnummer.setText(userInformation.getMatrikelnummer());
				}
			});

			return null;

		}

	}
}

@@ -92,40 +92,8 @@
 ty;%0A
-import android.content.Context;%0A
 impo
@@ -1491,71 +1491,105 @@
 %0A%09%09p
-ublic UserInfoTask(Context context) %7B%0A%09%09%09super(context, context
+rivate Activity activity;%0A%0A%09%09public UserInfoTask(Activity activity) %7B%0A%09%09%09super(activity, activity
 .get
@@ -1626,16 +1626,45 @@
 info));%0A
+%09%09%09this.activity = activity;%0A
 %09%09%7D%0A%0A%09%09@
@@ -1934,21 +1934,16 @@
 %0A%09%09%09
-getA
+a
 ctivity
-()
 .run

Use the passed activity instead of getActivity() in BenutzerinfoFragment's AsyncTask