Java tutorial
//package com.java2s; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.preference.PreferenceManager; public class Main { public static AlertDialog showTutorialDialog(final Context context) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle("Watch a YouTube video tutorial?"); builder.setIcon(android.R.drawable.ic_dialog_info); builder.setPositiveButton("Watch", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean("firstrun", false) .commit(); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.youtube.com/watch?v=LhiSWE5-ezM")); context.startActivity(browserIntent); } }); builder.setNeutralButton("Close", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean("firstrun", false) .commit(); dialog.dismiss(); } }); AlertDialog alert = builder.create(); alert.show(); return alert; } }