List of usage examples for android.content ActivityNotFoundException toString
public String toString()
From source file:com.phonegap.plugins.slaveBrowser.SlaveBrowser.java
/** * Display a new browser with the specified URL. * * @param url The url to load.// w w w. ja v a 2 s. co m * @param usePhoneGap Load url in PhoneGap webview * @return "" if ok, or error message. */ public String openExternal(String url, boolean usePhoneGap) { try { Intent intent = null; if (usePhoneGap) { intent = new Intent().setClass(this.ctx.getContext(), org.apache.cordova.DroidGap.class); intent.setData(Uri.parse(url)); // This line will be removed in future. intent.putExtra("url", url); // Timeout parameter: 60 sec max - May be less if http device timeout is less. intent.putExtra("loadUrlTimeoutValue", 60000); // These parameters can be configured if you want to show the loading dialog intent.putExtra("loadingDialog", "Wait,Loading web page..."); // show loading dialog intent.putExtra("hideLoadingDialogOnPageLoad", true); // hide it once page has completely loaded } else { intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); } this.ctx.startActivity(intent); return ""; } catch (android.content.ActivityNotFoundException e) { Log.d(LOG_TAG, "Error loading url " + url + ":" + e.toString()); return e.toString(); } }
From source file:com.phonegap.childBrowser.ChildBrowser.java
/** * Display a new browser with the specified URL. * * @param url The url to load. * @param usePhoneGap Load url in PhoneGap webview * @return "" if ok, or error message. *//*from w ww .j av a2s.c o m*/ public String openExternal(String url, boolean usePhoneGap) { try { Intent intent = null; if (usePhoneGap) { intent = new Intent().setClass(this.ctx, com.phonegap.DroidGap.class); intent.setData(Uri.parse(url)); // This line will be removed in future. intent.putExtra("url", url); // Timeout parameter: 60 sec max - May be less if http device timeout is less. intent.putExtra("loadUrlTimeoutValue", 60000); // These parameters can be configured if you want to show the loading dialog intent.putExtra("loadingDialog", "Wait,Loading web page..."); // show loading dialog intent.putExtra("hideLoadingDialogOnPageLoad", true); // hide it once page has completely loaded } else { intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); } this.ctx.startActivity(intent); return ""; } catch (android.content.ActivityNotFoundException e) { Log.d(LOG_TAG, "ChildBrowser: Error loading url " + url + ":" + e.toString()); return e.toString(); } }
From source file:com.polyvi.xface.extension.telephony.XTelephonyExt.java
/** * ???//w w w .j a va 2 s. com * * @param[in] phoneNumber ???? * @return ??? */ private boolean initiateVoiceCall(String phoneNumber) { try { if (isLegalPhoneNum(phoneNumber)) { Intent intent = new Intent(Intent.ACTION_CALL); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse(WebView.SCHEME_TEL + phoneNumber)); mContext.startActivity(intent); return true; } } catch (ActivityNotFoundException e) { XLog.e(CLASS_NAME, e.toString()); } catch (SecurityException e) { XLog.e(CLASS_NAME, e.toString()); } return false; }
From source file:com.polyvi.xface.extension.XTelephonyExt.java
/** * ???/*from ww w. j a v a 2s .c o m*/ * * @param[in] phoneNumber ???? * @return ??? * */ private boolean initiateVoiceCall(String phoneNumber) { try { if (isLegalPhoneNum(phoneNumber)) { Intent intent = new Intent(Intent.ACTION_CALL); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse(WebView.SCHEME_TEL + phoneNumber)); getContext().startActivity(intent); return true; } } catch (ActivityNotFoundException e) { XLog.e(CLASS_NAME, e.toString()); } catch (SecurityException e) { XLog.e(CLASS_NAME, e.toString()); } return false; }
From source file:com.phonegap.plugins.ChildBrowser.java
/** * Display a new browser with the specified URL. * * @param url The url to load.// ww w . j a v a2 s . c o m * @param usePhoneGap Load url in PhoneGap webview * @return "" if ok, or error message. */ public String openExternal(String url, boolean usePhoneGap) { try { Intent intent = null; if (usePhoneGap) { intent = new Intent().setClass(this.cordova.getActivity(), org.apache.cordova.DroidGap.class); intent.setData(Uri.parse(url)); // This line will be removed in future. intent.putExtra("url", url); // Timeout parameter: 60 sec max - May be less if http device timeout is less. intent.putExtra("loadUrlTimeoutValue", 60000); // These parameters can be configured if you want to show the loading dialog intent.putExtra("loadingDialog", "Wait,Loading web page..."); // show loading dialog intent.putExtra("hideLoadingDialogOnPageLoad", true); // hide it once page has completely loaded } else { intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); } this.cordova.getActivity().startActivity(intent); return ""; } catch (android.content.ActivityNotFoundException e) { Log.d(LOG_TAG, "ChildBrowser: Error loading url " + url + ":" + e.toString()); return e.toString(); } }
From source file:com.dhaval.mobile.plugin.ChildBrowser.java
/** * Display a new browser with the specified URL. * * @param url The url to load. * @param usePhoneGap Load url in PhoneGap webview * @return "" if ok, or error message. *//*ww w . j a va 2 s . com*/ public String openExternal(String url, boolean usePhoneGap) { try { Intent intent = null; if (usePhoneGap) { intent = new Intent().setClass(this.ctx.getContext(), org.apache.cordova.DroidGap.class); intent.setData(Uri.parse(url)); // This line will be removed in future. intent.putExtra("url", url); // Timeout parameter: 60 sec max - May be less if http device timeout is less. intent.putExtra("loadUrlTimeoutValue", 60000); // These parameters can be configured if you want to show the loading dialog intent.putExtra("loadingDialog", "Wait,Loading web page..."); // show loading dialog intent.putExtra("hideLoadingDialogOnPageLoad", true); // hide it once page has completely loaded } else { intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); } this.ctx.startActivity(intent); return ""; } catch (android.content.ActivityNotFoundException e) { Log.d(LOG_TAG, "ChildBrowser: Error loading url " + url + ":" + e.toString()); return e.toString(); } }
From source file:com.app.plugins.childBrowser.ChildBrowser.java
/** * Display a new browser with the specified URL. * * @param url The url to load. * @param usePhoneGap Load url in PhoneGap webview * @return "" if ok, or error message. *//*from w ww . jav a 2 s . c o m*/ public String openExternal(String url, boolean usePhoneGap) { try { Intent intent = null; if (usePhoneGap) { intent = new Intent().setClass(this.cordova.getActivity(), DroidGap.class); intent.setData(Uri.parse(url)); // This line will be removed in future. intent.putExtra("url", url); // Timeout parameter: 60 sec max - May be less if http device timeout is less. intent.putExtra("loadUrlTimeoutValue", 60000); // These parameters can be configured if you want to show the loading dialog intent.putExtra("loadingDialog", "Wait,Loading web page..."); // show loading dialog intent.putExtra("hideLoadingDialogOnPageLoad", true); // hide it once page has completely loaded } else { intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); } this.cordova.getActivity().startActivity(intent); return ""; } catch (android.content.ActivityNotFoundException e) { Log.d(LOG_TAG, "ChildBrowser: Error loading url " + url + ":" + e.toString()); return e.toString(); } }
From source file:rdx.andro.forexcapplugins.childBrowser.ChildBrowser.java
/** * Display a new browser with the specified URL. * //ww w . j a va 2s . c om * @param url * The url to load. * @param usePhoneGap * Load url in PhoneGap webview * @return "" if ok, or error message. */ public String openExternal(String url, boolean usePhoneGap) { try { Intent intent = null; if (usePhoneGap) { intent = new Intent().setClass(this.cordova.getActivity(), org.apache.cordova.DroidGap.class); intent.setData(Uri.parse(url)); // This line will be removed in // future. intent.putExtra("url", url); // Timeout parameter: 60 sec max - May be less if http device // timeout is less. intent.putExtra("loadUrlTimeoutValue", 60000); // These parameters can be configured if you want to show the // loading dialog intent.putExtra("loadingDialog", "Wait,Loading web page..."); // show // loading // dialog intent.putExtra("hideLoadingDialogOnPageLoad", true); // hide it // once // page // has // completely // loaded } else { intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(url)); } this.cordova.getActivity().startActivity(intent); return ""; } catch (android.content.ActivityNotFoundException e) { Log.d(LOG_TAG, "ChildBrowser: Error loading url " + url + ":" + e.toString()); return e.toString(); } }
From source file:org.hfoss.posit.android.RegisterActivity.java
/** * Handle all button clicks. There are two main buttons that appear on the View * when the Activity is started. When one of those buttons is clicked, a new * View is displayed with one or more additional buttons. *//*from w ww. ja va2 s . c om*/ public void onClick(View v) { if (!Utils.isNetworkAvailable(this)) { Utils.showToast(this, "There's a problem. To register you must be on a network."); return; } Intent intent; switch (v.getId()) { // Register phone for an existing account case R.id.register: mAction = RegisterActivity.REGISTER_USER; createNewUserAccount(); break; // Create a new user account case R.id.login: mAction = RegisterActivity.REGISTER_PHONE; registerExistingAccount(); break; // Register the phone from the phone by providing valid email and password case R.id.registerDeviceButton: String password = (((TextView) findViewById(R.id.password)).getText()).toString(); String email = (((TextView) findViewById(R.id.email)).getText()).toString(); if (password.equals("") || email.equals("")) { Utils.showToast(this, "Please fill in all the fields"); break; } EmailValidator emailValidator = EmailValidator.getInstance(); if (emailValidator.isValid(email) != true) { Utils.showToast(this, "Please enter a valid address"); break; } loginUser(email, password); break; // Register the phone by reading a barcode on the server's website (Settings > Register) case R.id.registerUsingBarcodeButton: if (!isIntentAvailable(this, "com.google.zxing.client.android.SCAN")) { Utils.showToast(this, "Please install the Zxing Barcode Scanner from the Market"); break; } intent = new Intent("com.google.zxing.client.android.SCAN"); try { startActivityForResult(intent, LOGIN_BY_BARCODE_READER); } catch (ActivityNotFoundException e) { if (Utils.debug) Log.i(TAG, e.toString()); } break; // User clicks the "Login" button in the Create User View case (R.id.submitInfo): password = (((TextView) findViewById(R.id.password)).getText()).toString(); String check = (((TextView) findViewById(R.id.passCheck)).getText()).toString(); email = (((TextView) findViewById(R.id.email)).getText()).toString(); String lastname = (((TextView) findViewById(R.id.lastName)).getText()).toString(); String firstname = (((TextView) findViewById(R.id.firstName)).getText()).toString(); if (password.equals("") || check.equals("") || lastname.equals("") || firstname.equals("") || email.equals("")) { Utils.showToast(this, "Please fill in all the fields"); break; } EmailValidator emV = EmailValidator.getInstance(); if (emV.isValid(email) != true) { Utils.showToast(this, "Please enter a valid email address"); break; } if (!check.equals(password)) { Utils.showToast(this, "Your passwords do not match"); break; } TelephonyManager manager = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); String imei = manager.getDeviceId(); Communicator com = new Communicator(this); String server = mSharedPrefs.getString("SERVER_ADDRESS", getString(R.string.defaultServer)); String result = com.registerUser(server, firstname, lastname, email, password, check, imei); Log.i(TAG, "RegisterUser result = " + result); if (result != null) { String[] message = result.split(":"); if (message.length != 2) { Utils.showToast(this, "Error: " + result); break; } // A new account has successfully been created. if (message[0].equals("" + Constants.AUTHN_OK)) { Editor editor = mSharedPrefs.edit(); editor.putString("EMAIL", email); editor.commit(); // The user logs in to register the device. loginUser(email, password); } else { Utils.showToast(this, message[1]); } break; } mProgressDialog.dismiss(); } }
From source file:org.cowboycoders.cyclisimo.CourseListActivity.java
private void showChooser() { // Use the GET_CONTENT intent from the utility class Intent target = FileUtils.createGetContentIntent(); // Create the chooser Intent Intent intent = Intent.createChooser(target, getString(R.string.course_file_chooser_title)); try {//from www . jav a2s. c o m startActivityForResult(intent, REQUEST_CODE); } catch (ActivityNotFoundException e) { Toast.makeText(CourseListActivity.this, "SecurityException: unable to load file manager", Toast.LENGTH_LONG).show(); Log.e(TAG, e.toString()); } }