Here you can find the source of getInstallationDialog(final Context context)
public static Dialog getInstallationDialog(final Context context)
//package com.java2s; /**/*from www. j a v a 2 s .c o m*/ * Copyright (C) 2012 SINTEF <fabien@fleurey.com> * * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, Version 3, 29 June 2007; * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.gnu.org/licenses/lgpl-3.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import android.app.AlertDialog; import android.app.Dialog; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; public class Main { public static Dialog getInstallationDialog(final Context context) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setMessage("SensApp application is needed. Would you like install it now?"); builder.setCancelable(false); builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { Uri uri = Uri.parse("market://details?id=" + "org.sensapp.android.sensappdroid"); try { context.startActivity(new Intent( Intent.ACTION_VIEW, uri)); } catch (ActivityNotFoundException e) { e.printStackTrace(); } } }); builder.setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); return builder.create(); } }