-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLinkAlert.java
More file actions
35 lines (32 loc) · 1.26 KB
/
LinkAlert.java
File metadata and controls
35 lines (32 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.example.ikoala.ui.social;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
public class LinkAlert
{
public static void show(String url, Context context){
AlertDialog.Builder builder1 = new AlertDialog.Builder(context);
builder1.setMessage("You are about to open a link in an external browser, are you happy to proceed?");
builder1.setCancelable(true);
builder1.setPositiveButton(
"Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.dismiss();
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
context.startActivity(browserIntent);
}
});
builder1.setNegativeButton(
"Cancel",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
AlertDialog alert11 = builder1.create();
alert11.show();
}
}