package cgeo.geocaching;

import java.util.Locale;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import cgeo.geocaching.activity.AbstractActivity;

public class cgeohelpers extends AbstractActivity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		// init
		setTheme();
		setContentView(R.layout.helpers);
		setTitle(res.getString(R.string.helpers));
	}

	@Override
	public void onResume() {
		super.onResume();

		settings.load();
	}

	public void installManual(View view) {
		final Locale loc = Locale.getDefault();
		final String lng = loc.getLanguage();

		try {
			if (lng.equalsIgnoreCase("de")) {
				startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:gnu.android.app.cgeomanual.de")));
			} else {
				startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:gnu.android.app.cgeomanual.en")));
			}
		} catch (Exception e) {
			// market not available in standard emulator
		}


		finish();
	}

	public void installLocus(View view) {
		try {
			startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:menion.android.locus")));
		} catch (Exception e) {
			// market not available in standard emulator
		}


		finish();
	}

	public void installGpsStatus(View view) {
		try {
			startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:com.eclipsim.gpsstatus2")));
		} catch (Exception e) {
			// market not available in standard emulator
		}

		finish();
	}

	public void installBluetoothGps(View view) {
		try {
			startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:googoo.android.btgps")));
		} catch (Exception e) {
			// market not available in standard emulator
		}

		finish();
	}
}

package cgeo.geocaching;

import java.util.Locale;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import cgeo.geocaching.activity.AbstractActivity;

public class cgeohelpers extends AbstractActivity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		// init
		setTheme();
		setContentView(R.layout.helpers);
		setTitle(res.getString(R.string.helpers));
	}

	@Override
	public void onResume() {
		super.onResume();

		settings.load();
	}

	private void installFromMarket(String marketId) {
		try {
			startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=pname:" + marketId)));
		} catch (Exception e) {
			// market not available in standard emulator
		}

		finish();
	}

	public void installManual(View view) {
		final Locale loc = Locale.getDefault();
		final String language = loc.getLanguage();

		if ("de".equalsIgnoreCase(language)) {
			installFromMarket("gnu.android.app.cgeomanual.de");
		}
		else {
			installFromMarket("gnu.android.app.cgeomanual.en");
		}
	}

	public void installLocus(View view) {
		installFromMarket("menion.android.locus");
	}

	public void installGpsStatus(View view) {
		installFromMarket("com.eclipsim.gpsstatus2");
	}

	public void installBluetoothGps(View view) {
		installFromMarket("googoo.android.btgps");
	}
}

remove duplicate code