package com.eni.android.anotherapp;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class LlamarAOtraApp extends Activity {

	private static final String COM_ANDROID_SETTINGS = "com.android.settings";

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		Button launchMap = (Button) findViewById(R.id.launchMap);
		launchMap.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				PackageManager pm = getPackageManager();
				/* Verifier si l'activite cible existe */
				Intent intent = pm
						.getLaunchIntentForPackage(COM_ANDROID_SETTINGS);
				/* Executer l'activite cible */
				if (intent != null)
					startActivity(intent);
				else
					Toast.makeText(
							LlamarAOtraApp.this,
							R.string.app_no_disp,
							Toast.LENGTH_LONG).show();
			}
		});

	}
}
