2 * Copyright (C) 2012-2016 Tobias Brunner
3 * Copyright (C) 2012 Giuliano Grassi
4 * Copyright (C) 2012 Ralf Sager
5 * HSR Hochschule fuer Technik Rapperswil
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
18 package org
.strongswan
.android
.ui
;
20 import android
.app
.Dialog
;
21 import android
.content
.Context
;
22 import android
.content
.DialogInterface
;
23 import android
.content
.Intent
;
24 import android
.os
.AsyncTask
;
25 import android
.os
.Bundle
;
26 import android
.security
.KeyChain
;
27 import android
.security
.KeyChainAliasCallback
;
28 import android
.security
.KeyChainException
;
29 import android
.support
.v7
.app
.AlertDialog
;
30 import android
.support
.v7
.app
.AppCompatActivity
;
31 import android
.support
.v7
.app
.AppCompatDialogFragment
;
32 import android
.text
.Editable
;
33 import android
.text
.Html
;
34 import android
.text
.TextUtils
;
35 import android
.text
.TextWatcher
;
36 import android
.util
.Log
;
37 import android
.view
.Menu
;
38 import android
.view
.MenuInflater
;
39 import android
.view
.MenuItem
;
40 import android
.view
.View
;
41 import android
.view
.View
.OnClickListener
;
42 import android
.view
.ViewGroup
;
43 import android
.widget
.AdapterView
;
44 import android
.widget
.AdapterView
.OnItemSelectedListener
;
45 import android
.widget
.CheckBox
;
46 import android
.widget
.CompoundButton
;
47 import android
.widget
.CompoundButton
.OnCheckedChangeListener
;
48 import android
.widget
.EditText
;
49 import android
.widget
.RelativeLayout
;
50 import android
.widget
.Spinner
;
51 import android
.widget
.TextView
;
53 import org
.strongswan
.android
.R
;
54 import org
.strongswan
.android
.data
.VpnProfile
;
55 import org
.strongswan
.android
.data
.VpnProfileDataSource
;
56 import org
.strongswan
.android
.data
.VpnType
;
57 import org
.strongswan
.android
.data
.VpnType
.VpnTypeFeature
;
58 import org
.strongswan
.android
.logic
.TrustedCertificateManager
;
59 import org
.strongswan
.android
.security
.TrustedCertificateEntry
;
60 import org
.strongswan
.android
.ui
.widget
.TextInputLayoutHelper
;
62 import java
.security
.cert
.X509Certificate
;
64 public class VpnProfileDetailActivity
extends AppCompatActivity
66 private static final int SELECT_TRUSTED_CERTIFICATE
= 0;
67 private static final int MTU_MIN
= 1280;
68 private static final int MTU_MAX
= 1500;
70 private VpnProfileDataSource mDataSource
;
72 private TrustedCertificateEntry mCertEntry
;
73 private String mUserCertLoading
;
74 private TrustedCertificateEntry mUserCertEntry
;
75 private VpnType mVpnType
= VpnType
.IKEV2_EAP
;
76 private VpnProfile mProfile
;
77 private EditText mName
;
78 private TextInputLayoutHelper mNameWrap
;
79 private EditText mGateway
;
80 private TextInputLayoutHelper mGatewayWrap
;
81 private Spinner mSelectVpnType
;
82 private ViewGroup mUsernamePassword
;
83 private EditText mUsername
;
84 private TextInputLayoutHelper mUsernameWrap
;
85 private EditText mPassword
;
86 private ViewGroup mUserCertificate
;
87 private RelativeLayout mSelectUserCert
;
88 private CheckBox mCheckAuto
;
89 private RelativeLayout mSelectCert
;
90 private RelativeLayout mTncNotice
;
91 private CheckBox mShowAdvanced
;
92 private ViewGroup mAdvancedSettings
;
93 private EditText mRemoteId
;
94 private TextInputLayoutHelper mRemoteIdWrap
;
95 private EditText mMTU
;
96 private TextInputLayoutHelper mMTUWrap
;
97 private EditText mPort
;
98 private TextInputLayoutHelper mPortWrap
;
99 private CheckBox mBlockIPv4
;
100 private CheckBox mBlockIPv6
;
103 public void onCreate(Bundle savedInstanceState
)
105 super.onCreate(savedInstanceState
);
107 /* the title is set when we load the profile, if any */
108 getSupportActionBar().setDisplayHomeAsUpEnabled(true);
110 mDataSource
= new VpnProfileDataSource(this);
113 setContentView(R
.layout
.profile_detail_view
);
115 mName
= (EditText
)findViewById(R
.id
.name
);
116 mNameWrap
= (TextInputLayoutHelper
)findViewById(R
.id
.name_wrap
);
117 mGateway
= (EditText
)findViewById(R
.id
.gateway
);
118 mGatewayWrap
= (TextInputLayoutHelper
) findViewById(R
.id
.gateway_wrap
);
119 mSelectVpnType
= (Spinner
)findViewById(R
.id
.vpn_type
);
120 mTncNotice
= (RelativeLayout
)findViewById(R
.id
.tnc_notice
);
122 mUsernamePassword
= (ViewGroup
)findViewById(R
.id
.username_password_group
);
123 mUsername
= (EditText
)findViewById(R
.id
.username
);
124 mUsernameWrap
= (TextInputLayoutHelper
) findViewById(R
.id
.username_wrap
);
125 mPassword
= (EditText
)findViewById(R
.id
.password
);
127 mUserCertificate
= (ViewGroup
)findViewById(R
.id
.user_certificate_group
);
128 mSelectUserCert
= (RelativeLayout
)findViewById(R
.id
.select_user_certificate
);
130 mCheckAuto
= (CheckBox
)findViewById(R
.id
.ca_auto
);
131 mSelectCert
= (RelativeLayout
)findViewById(R
.id
.select_certificate
);
133 mShowAdvanced
= (CheckBox
)findViewById(R
.id
.show_advanced
);
134 mAdvancedSettings
= (ViewGroup
)findViewById(R
.id
.advanced_settings
);
136 mRemoteId
= (EditText
)findViewById(R
.id
.remote_id
);
137 mRemoteIdWrap
= (TextInputLayoutHelper
) findViewById(R
.id
.remote_id_wrap
);
138 mMTU
= (EditText
)findViewById(R
.id
.mtu
);
139 mMTUWrap
= (TextInputLayoutHelper
) findViewById(R
.id
.mtu_wrap
);
140 mPort
= (EditText
)findViewById(R
.id
.port
);
141 mPortWrap
= (TextInputLayoutHelper
) findViewById(R
.id
.port_wrap
);
142 mBlockIPv4
= (CheckBox
)findViewById(R
.id
.split_tunneling_v4
);
143 mBlockIPv6
= (CheckBox
)findViewById(R
.id
.split_tunneling_v6
);
145 mGateway
.addTextChangedListener(new TextWatcher() {
147 public void beforeTextChanged(CharSequence s
, int start
, int count
, int after
) {}
150 public void onTextChanged(CharSequence s
, int start
, int before
, int count
) {}
153 public void afterTextChanged(Editable s
)
155 if (TextUtils
.isEmpty(mGateway
.getText()))
157 mNameWrap
.setHelperText(getString(R
.string
.profile_name_hint
));
158 mRemoteIdWrap
.setHelperText(getString(R
.string
.profile_remote_id_hint
));
162 mNameWrap
.setHelperText(String
.format(getString(R
.string
.profile_name_hint_gateway
), mGateway
.getText()));
163 mRemoteIdWrap
.setHelperText(String
.format(getString(R
.string
.profile_remote_id_hint_gateway
), mGateway
.getText()));
168 mSelectVpnType
.setOnItemSelectedListener(new OnItemSelectedListener() {
170 public void onItemSelected(AdapterView
<?
> parent
, View view
, int position
, long id
)
172 mVpnType
= VpnType
.values()[position
];
173 updateCredentialView();
177 public void onNothingSelected(AdapterView
<?
> parent
)
178 { /* should not happen */
179 mVpnType
= VpnType
.IKEV2_EAP
;
180 updateCredentialView();
184 ((TextView
)mTncNotice
.findViewById(android
.R
.id
.text1
)).setText(R
.string
.tnc_notice_title
);
185 ((TextView
)mTncNotice
.findViewById(android
.R
.id
.text2
)).setText(R
.string
.tnc_notice_subtitle
);
186 mTncNotice
.setOnClickListener(new OnClickListener() {
188 public void onClick(View v
)
190 new TncNoticeDialog().show(VpnProfileDetailActivity
.this.getSupportFragmentManager(), "TncNotice");
194 mSelectUserCert
.setOnClickListener(new SelectUserCertOnClickListener());
196 mCheckAuto
.setOnCheckedChangeListener(new OnCheckedChangeListener() {
198 public void onCheckedChanged(CompoundButton buttonView
, boolean isChecked
)
200 updateCertificateSelector();
204 mSelectCert
.setOnClickListener(new OnClickListener() {
206 public void onClick(View v
)
208 Intent intent
= new Intent(VpnProfileDetailActivity
.this, TrustedCertificatesActivity
.class);
209 intent
.setAction(TrustedCertificatesActivity
.SELECT_CERTIFICATE
);
210 startActivityForResult(intent
, SELECT_TRUSTED_CERTIFICATE
);
214 mShowAdvanced
.setOnCheckedChangeListener(new OnCheckedChangeListener() {
216 public void onCheckedChanged(CompoundButton buttonView
, boolean isChecked
)
218 updateAdvancedSettings();
222 mId
= savedInstanceState
== null ?
null : savedInstanceState
.getLong(VpnProfileDataSource
.KEY_ID
);
225 Bundle extras
= getIntent().getExtras();
226 mId
= extras
== null ?
null : extras
.getLong(VpnProfileDataSource
.KEY_ID
);
229 loadProfileData(savedInstanceState
);
231 updateCredentialView();
232 updateCertificateSelector();
233 updateAdvancedSettings();
237 protected void onDestroy()
244 protected void onSaveInstanceState(Bundle outState
)
246 super.onSaveInstanceState(outState
);
249 outState
.putLong(VpnProfileDataSource
.KEY_ID
, mId
);
251 if (mUserCertEntry
!= null)
253 outState
.putString(VpnProfileDataSource
.KEY_USER_CERTIFICATE
, mUserCertEntry
.getAlias());
255 if (mCertEntry
!= null)
257 outState
.putString(VpnProfileDataSource
.KEY_CERTIFICATE
, mCertEntry
.getAlias());
262 public boolean onCreateOptionsMenu(Menu menu
)
264 MenuInflater inflater
= getMenuInflater();
265 inflater
.inflate(R
.menu
.profile_edit
, menu
);
270 public boolean onOptionsItemSelected(MenuItem item
)
272 switch (item
.getItemId())
274 case android
.R
.id
.home
:
275 case R
.id
.menu_cancel
:
278 case R
.id
.menu_accept
:
282 return super.onOptionsItemSelected(item
);
287 protected void onActivityResult(int requestCode
, int resultCode
, Intent data
)
291 case SELECT_TRUSTED_CERTIFICATE
:
292 if (resultCode
== RESULT_OK
)
294 String alias
= data
.getStringExtra(VpnProfileDataSource
.KEY_CERTIFICATE
);
295 X509Certificate certificate
= TrustedCertificateManager
.getInstance().getCACertificateFromAlias(alias
);
296 mCertEntry
= certificate
== null ?
null : new TrustedCertificateEntry(alias
, certificate
);
297 updateCertificateSelector();
301 super.onActivityResult(requestCode
, resultCode
, data
);
306 * Update the UI to enter credentials depending on the type of VPN currently selected
308 private void updateCredentialView()
310 mUsernamePassword
.setVisibility(mVpnType
.has(VpnTypeFeature
.USER_PASS
) ? View
.VISIBLE
: View
.GONE
);
311 mUserCertificate
.setVisibility(mVpnType
.has(VpnTypeFeature
.CERTIFICATE
) ? View
.VISIBLE
: View
.GONE
);
312 mTncNotice
.setVisibility(mVpnType
.has(VpnTypeFeature
.BYOD
) ? View
.VISIBLE
: View
.GONE
);
314 if (mVpnType
.has(VpnTypeFeature
.CERTIFICATE
))
316 if (mUserCertLoading
!= null)
318 ((TextView
)mSelectUserCert
.findViewById(android
.R
.id
.text1
)).setText(mUserCertLoading
);
319 ((TextView
)mSelectUserCert
.findViewById(android
.R
.id
.text2
)).setText(R
.string
.loading
);
321 else if (mUserCertEntry
!= null)
322 { /* clear any errors and set the new data */
323 ((TextView
)mSelectUserCert
.findViewById(android
.R
.id
.text1
)).setError(null);
324 ((TextView
)mSelectUserCert
.findViewById(android
.R
.id
.text1
)).setText(mUserCertEntry
.getAlias());
325 ((TextView
)mSelectUserCert
.findViewById(android
.R
.id
.text2
)).setText(mUserCertEntry
.getCertificate().getSubjectDN().toString());
329 ((TextView
)mSelectUserCert
.findViewById(android
.R
.id
.text1
)).setText(R
.string
.profile_user_select_certificate_label
);
330 ((TextView
)mSelectUserCert
.findViewById(android
.R
.id
.text2
)).setText(R
.string
.profile_user_select_certificate
);
336 * Show an alert in case the previously selected certificate is not found anymore
337 * or the user did not select a certificate in the spinner.
339 private void showCertificateAlert()
341 AlertDialog
.Builder adb
= new AlertDialog
.Builder(VpnProfileDetailActivity
.this);
342 adb
.setTitle(R
.string
.alert_text_nocertfound_title
);
343 adb
.setMessage(R
.string
.alert_text_nocertfound
);
344 adb
.setPositiveButton(android
.R
.string
.ok
, new DialogInterface
.OnClickListener() {
346 public void onClick(DialogInterface dialog
, int id
)
355 * Update the CA certificate selection UI depending on whether the
356 * certificate should be automatically selected or not.
358 private void updateCertificateSelector()
360 if (!mCheckAuto
.isChecked())
362 mSelectCert
.setEnabled(true);
363 mSelectCert
.setVisibility(View
.VISIBLE
);
365 if (mCertEntry
!= null)
367 ((TextView
)mSelectCert
.findViewById(android
.R
.id
.text1
)).setText(mCertEntry
.getSubjectPrimary());
368 ((TextView
)mSelectCert
.findViewById(android
.R
.id
.text2
)).setText(mCertEntry
.getSubjectSecondary());
372 ((TextView
)mSelectCert
.findViewById(android
.R
.id
.text1
)).setText(R
.string
.profile_ca_select_certificate_label
);
373 ((TextView
)mSelectCert
.findViewById(android
.R
.id
.text2
)).setText(R
.string
.profile_ca_select_certificate
);
378 mSelectCert
.setEnabled(false);
379 mSelectCert
.setVisibility(View
.GONE
);
384 * Update the advanced settings UI depending on whether any advanced
385 * settings have already been made.
387 private void updateAdvancedSettings()
389 boolean show
= mShowAdvanced
.isChecked();
390 if (!show
&& mProfile
!= null)
392 Integer st
= mProfile
.getSplitTunneling();
393 show
= mProfile
.getRemoteId() != null || mProfile
.getMTU() != null ||
394 mProfile
.getPort() != null || (st
!= null && st
!= 0);
396 mShowAdvanced
.setVisibility(!show ? View
.VISIBLE
: View
.GONE
);
397 mAdvancedSettings
.setVisibility(show ? View
.VISIBLE
: View
.GONE
);
401 * Save or update the profile depending on whether we actually have a
402 * profile object or not (this was created in updateProfileData)
404 private void saveProfile()
408 if (mProfile
!= null)
411 mDataSource
.updateVpnProfile(mProfile
);
415 mProfile
= new VpnProfile();
417 mDataSource
.insertProfile(mProfile
);
419 setResult(RESULT_OK
, new Intent().putExtra(VpnProfileDataSource
.KEY_ID
, mProfile
.getId()));
425 * Verify the user input and display error messages.
426 * @return true if the input is valid
428 private boolean verifyInput()
430 boolean valid
= true;
431 if (mGateway
.getText().toString().trim().isEmpty())
433 mGatewayWrap
.setError(getString(R
.string
.alert_text_no_input_gateway
));
436 if (mVpnType
.has(VpnTypeFeature
.USER_PASS
))
438 if (mUsername
.getText().toString().trim().isEmpty())
440 mUsernameWrap
.setError(getString(R
.string
.alert_text_no_input_username
));
444 if (mVpnType
.has(VpnTypeFeature
.CERTIFICATE
) && mUserCertEntry
== null)
445 { /* let's show an error icon */
446 ((TextView
)mSelectUserCert
.findViewById(android
.R
.id
.text1
)).setError("");
449 if (!mCheckAuto
.isChecked() && mCertEntry
== null)
451 showCertificateAlert();
454 Integer mtu
= getInteger(mMTU
);
455 if (mtu
!= null && (mtu
< MTU_MIN
|| mtu
> MTU_MAX
))
457 mMTUWrap
.setError(String
.format(getString(R
.string
.alert_text_out_of_range
), MTU_MIN
, MTU_MAX
));
460 Integer port
= getInteger(mPort
);
461 if (port
!= null && (port
< 1 || port
> 65535))
463 mPortWrap
.setError(String
.format(getString(R
.string
.alert_text_out_of_range
), 1, 65535));
470 * Update the profile object with the data entered by the user
472 private void updateProfileData()
474 /* the name is optional, we default to the gateway if none is given */
475 String name
= mName
.getText().toString().trim();
476 String gateway
= mGateway
.getText().toString().trim();
477 mProfile
.setName(name
.isEmpty() ? gateway
: name
);
478 mProfile
.setGateway(gateway
);
479 mProfile
.setVpnType(mVpnType
);
480 if (mVpnType
.has(VpnTypeFeature
.USER_PASS
))
482 mProfile
.setUsername(mUsername
.getText().toString().trim());
483 String password
= mPassword
.getText().toString().trim();
484 password
= password
.isEmpty() ?
null : password
;
485 mProfile
.setPassword(password
);
487 if (mVpnType
.has(VpnTypeFeature
.CERTIFICATE
))
489 mProfile
.setUserCertificateAlias(mUserCertEntry
.getAlias());
491 String certAlias
= mCheckAuto
.isChecked() ?
null : mCertEntry
.getAlias();
492 mProfile
.setCertificateAlias(certAlias
);
493 String remote_id
= mRemoteId
.getText().toString().trim();
494 mProfile
.setRemoteId(remote_id
.isEmpty() ?
null : remote_id
);
495 mProfile
.setMTU(getInteger(mMTU
));
496 mProfile
.setPort(getInteger(mPort
));
498 st
|= mBlockIPv4
.isChecked() ? VpnProfile
.SPLIT_TUNNELING_BLOCK_IPV4
: 0;
499 st
|= mBlockIPv6
.isChecked() ? VpnProfile
.SPLIT_TUNNELING_BLOCK_IPV6
: 0;
500 mProfile
.setSplitTunneling(st
== 0 ?
null : st
);
504 * Load an existing profile if we got an ID
506 * @param savedInstanceState previously saved state
508 private void loadProfileData(Bundle savedInstanceState
)
510 String useralias
= null, alias
= null;
512 getSupportActionBar().setTitle(R
.string
.add_profile
);
513 if (mId
!= null && mId
!= 0)
515 mProfile
= mDataSource
.getVpnProfile(mId
);
516 if (mProfile
!= null)
518 mName
.setText(mProfile
.getName());
519 mGateway
.setText(mProfile
.getGateway());
520 mVpnType
= mProfile
.getVpnType();
521 mUsername
.setText(mProfile
.getUsername());
522 mPassword
.setText(mProfile
.getPassword());
523 mRemoteId
.setText(mProfile
.getRemoteId());
524 mMTU
.setText(mProfile
.getMTU() != null ? mProfile
.getMTU().toString() : null);
525 mPort
.setText(mProfile
.getPort() != null ? mProfile
.getPort().toString() : null);
526 mBlockIPv4
.setChecked(mProfile
.getSplitTunneling() != null ?
(mProfile
.getSplitTunneling() & VpnProfile
.SPLIT_TUNNELING_BLOCK_IPV4
) != 0 : false);
527 mBlockIPv6
.setChecked(mProfile
.getSplitTunneling() != null ?
(mProfile
.getSplitTunneling() & VpnProfile
.SPLIT_TUNNELING_BLOCK_IPV6
) != 0 : false);
528 useralias
= mProfile
.getUserCertificateAlias();
529 alias
= mProfile
.getCertificateAlias();
530 getSupportActionBar().setTitle(mProfile
.getName());
534 Log
.e(VpnProfileDetailActivity
.class.getSimpleName(),
535 "VPN profile with id " + mId
+ " not found");
540 mSelectVpnType
.setSelection(mVpnType
.ordinal());
542 /* check if the user selected a user certificate previously */
543 useralias
= savedInstanceState
== null ? useralias
: savedInstanceState
.getString(VpnProfileDataSource
.KEY_USER_CERTIFICATE
);
544 if (useralias
!= null)
546 UserCertificateLoader loader
= new UserCertificateLoader(this, useralias
);
547 mUserCertLoading
= useralias
;
551 /* check if the user selected a CA certificate previously */
552 alias
= savedInstanceState
== null ? alias
: savedInstanceState
.getString(VpnProfileDataSource
.KEY_CERTIFICATE
);
553 mCheckAuto
.setChecked(alias
== null);
556 X509Certificate certificate
= TrustedCertificateManager
.getInstance().getCACertificateFromAlias(alias
);
557 if (certificate
!= null)
559 mCertEntry
= new TrustedCertificateEntry(alias
, certificate
);
562 { /* previously selected certificate is not here anymore */
563 showCertificateAlert();
570 * Get the integer value in the given text box or null if empty
572 * @param view text box (numeric entry assumed)
574 private Integer
getInteger(EditText view
)
576 String value
= view
.getText().toString().trim();
577 return value
.isEmpty() ?
null : Integer
.valueOf(value
);
580 private class SelectUserCertOnClickListener
implements OnClickListener
, KeyChainAliasCallback
583 public void onClick(View v
)
585 String useralias
= mUserCertEntry
!= null ? mUserCertEntry
.getAlias() : null;
586 KeyChain
.choosePrivateKeyAlias(VpnProfileDetailActivity
.this, this, new String
[] { "RSA" }, null, null, -1, useralias
);
590 public void alias(final String alias
)
593 { /* otherwise the dialog was canceled, the request denied */
596 final X509Certificate
[] chain
= KeyChain
.getCertificateChain(VpnProfileDetailActivity
.this, alias
);
597 /* alias() is not called from our main thread */
598 runOnUiThread(new Runnable() {
602 if (chain
!= null && chain
.length
> 0)
604 mUserCertEntry
= new TrustedCertificateEntry(alias
, chain
[0]);
606 updateCredentialView();
610 catch (KeyChainException e
)
614 catch (InterruptedException e
)
623 * Load the selected user certificate asynchronously. This cannot be done
624 * from the main thread as getCertificateChain() calls back to our main
625 * thread to bind to the KeyChain service resulting in a deadlock.
627 private class UserCertificateLoader
extends AsyncTask
<Void
, Void
, X509Certificate
>
629 private final Context mContext
;
630 private final String mAlias
;
632 public UserCertificateLoader(Context context
, String alias
)
639 protected X509Certificate
doInBackground(Void
... params
)
641 X509Certificate
[] chain
= null;
644 chain
= KeyChain
.getCertificateChain(mContext
, mAlias
);
646 catch (KeyChainException e
)
650 catch (InterruptedException e
)
654 if (chain
!= null && chain
.length
> 0)
662 protected void onPostExecute(X509Certificate result
)
666 mUserCertEntry
= new TrustedCertificateEntry(mAlias
, result
);
669 { /* previously selected certificate is not here anymore */
670 ((TextView
)mSelectUserCert
.findViewById(android
.R
.id
.text1
)).setError("");
671 mUserCertEntry
= null;
673 mUserCertLoading
= null;
674 updateCredentialView();
679 * Dialog with notification message if EAP-TNC is used.
681 public static class TncNoticeDialog
extends AppCompatDialogFragment
684 public Dialog
onCreateDialog(Bundle savedInstanceState
)
686 return new AlertDialog
.Builder(getActivity())
687 .setTitle(R
.string
.tnc_notice_title
)
688 .setMessage(Html
.fromHtml(getString(R
.string
.tnc_notice_details
)))
689 .setPositiveButton(android
.R
.string
.ok
, new DialogInterface
.OnClickListener() {
691 public void onClick(DialogInterface dialog
, int id
)