List of usage examples for android.content Intent setClassName
public @NonNull Intent setClassName(@NonNull String packageName, @NonNull String className)
From source file:com.ringdroid.RingdroidEditActivity.java
private void chooseContactForRingtone(Uri uri) { try {/*ww w . java2 s. c om*/ Intent intent = new Intent(Intent.ACTION_EDIT, uri); intent.setClassName(this, "com.ringdroid.ChooseContactActivity"); startActivityForResult(intent, REQUEST_CODE_CHOOSE_CONTACT); } catch (Exception e) { Log.e("Ringdroid", "Couldn't open Choose Contact window"); } }
From source file:com.fvd.nimbus.BrowseActivity.java
public void onButtonClick(View v) { drawer.closeDrawer(GravityCompat.START); Intent ip = new Intent(); switch (v.getId()) { case R.id.lbTakePhoto: ip.putExtra("act", "photo"); ip.setClassName("com.fvd.nimbus", "com.fvd.nimbus.PaintActivity"); startActivity(ip);//from w ww .j a v a 2 s. com break; case R.id.lbFromGallery: ip.putExtra("act", "picture"); ip.setClassName("com.fvd.nimbus", "com.fvd.nimbus.PaintActivity"); startActivity(ip); break; case R.id.lbPdfAnnotate: ip.setClassName("com.fvd.nimbus", "com.fvd.nimbus.ChoosePDFActivity"); startActivity(ip); break; case R.id.libSettings: Intent inten = new Intent(getApplicationContext(), SettingsActivity.class); startActivityForResult(inten, SHOW_SETTINGS); overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out); return; default: break; } overridePendingTransition(R.anim.carbon_slide_in, R.anim.carbon_slide_out); finish(); }
From source file:com.netcompss.ffmpeg4android_client.BaseWizard.java
protected void startService() { if (started) { // Toast.makeText(this, "Service already started", Toast.LENGTH_SHORT).show(); } else {// w w w. j a v a 2 s . com Intent i = new Intent("com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge"); if (currentapiVersion >= android.os.Build.VERSION_CODES.LOLLIPOP) { i.setPackage("com.netcompss.ffmpeg4android"); } PackageManager packageManager = getPackageManager(); List<ResolveInfo> services = packageManager.queryIntentServices(i, 0); Log.i(Prefs.TAG, "!!!!!!!!!!!!!!!!!!services.size(): " + services.size()); if (services.size() > 0) { ResolveInfo service = services.get(0); i.setClassName(service.serviceInfo.packageName, service.serviceInfo.name); i.setAction("com.netcompss.ffmpeg4android.FFMpegRemoteServiceBridge"); if (currentapiVersion >= android.os.Build.VERSION_CODES.LOLLIPOP) { i.setPackage("com.netcompss.ffmpeg4android"); } if (!invokeFileInfoServiceFlag) { i.addCategory("Base"); Log.i(Prefs.TAG, "putting Base categoty"); } else { i.addCategory("Info"); Log.i(Prefs.TAG, "putting Info categoty"); } ComponentName cn = startService(i); Log.d(Prefs.TAG, "started: " + cn.getClassName()); } started = true; Log.d(Prefs.TAG, "Client startService()"); } }
From source file:com.bangalore.barcamp.activity.ShareActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.share_screen); mDrawerToggle = BCBFragmentUtils.setupActionBar(this, "Share"); // BCBUtils.createActionBarOnActivity(this); // BCBUtils.addNavigationActions(this); ((EditText) findViewById(R.id.editText1)).addTextChangedListener(new TextWatcher() { @Override//from w ww.j av a 2s .c om public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { ((TextView) findViewById(R.id.charsLeftTextView)).setText("Chars left: " + (140 - s.length() - 7)); } }); if (getIntent().hasExtra(SHARE_STRING)) { ((EditText) findViewById(R.id.editText1)).setText(getIntent().getStringExtra(SHARE_STRING)); } Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); final PackageManager pm = getPackageManager(); final Spinner spinner = (Spinner) findViewById(R.id.shareTypeSpinner); ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); final List<ResolveInfo> matches = pm.queryIntentActivities(intent, 0); String selectedItem = BCBSharedPrefUtils.getShareSettings(getApplicationContext()); int selectedPos = -1; for (ResolveInfo info : matches) { adapter.add(info.loadLabel(pm)); if (selectedItem.equals(info.loadLabel(pm))) { selectedPos = matches.indexOf(info); } } spinner.setAdapter(adapter); if (selectedPos != -1) { spinner.setSelected(true); spinner.setSelection(selectedPos); } ((TextView) findViewById(R.id.charsLeftTextView)).setText("Chars left: 140"); ((Button) findViewById(R.id.button1)).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("text/plain"); int appSelectedPos = spinner.getSelectedItemPosition(); ResolveInfo info = matches.get(appSelectedPos); intent.setClassName(info.activityInfo.packageName, info.activityInfo.name); BCBSharedPrefUtils.setShareSettings(getApplicationContext(), (String) info.loadLabel(pm)); intent.putExtra(Intent.EXTRA_TEXT, ((EditText) findViewById(R.id.editText1)).getText().toString() + " #barcampblr"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); } }); BCBFragmentUtils.addNavigationActions(this); supportInvalidateOptionsMenu(); Tracker t = ((BarcampBangalore) getApplication()).getTracker(); // Set screen name. t.setScreenName(this.getClass().getName()); // Send a screen view. t.send(new HitBuilders.AppViewBuilder().build()); }
From source file:de.baumann.browser.Browser.java
@SuppressLint("SetJavaScriptEnabled") @Override/*from w ww . j a v a 2 s . c om*/ public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_search) { mWebView.stopLoading(); String text = editText.getText().toString(); String searchEngine = sharedPref.getString("searchEngine", "https://startpage.com/do/search?query="); String wikiLang = sharedPref.getString("wikiLang", "en"); if (text.length() > 3) { subStr = text.substring(3); } if (text.equals(mWebView.getTitle()) || text.isEmpty()) { helper_editText.showKeyboard(Browser.this, editText, 3, "", getString(R.string.app_search_hint)); } else { helper_editText.hideKeyboard(Browser.this, editText, 0, text, getString(R.string.app_search_hint)); helper_editText.editText_EditorAction(editText, Browser.this, mWebView); if (text.startsWith("www")) { mWebView.loadUrl("http://" + text); } else if (text.contains("http")) { mWebView.loadUrl(text); } else if (text.contains(".w ")) { mWebView.loadUrl("https://" + wikiLang + ".wikipedia.org/wiki/Spezial:Suche?search=" + subStr); } else if (text.startsWith(".f ")) { mWebView.loadUrl("https://www.flickr.com/search/?advanced=1&license=2%2C3%2C4%2C5%2C6%2C9&text=" + subStr); } else if (text.startsWith(".m ")) { mWebView.loadUrl("https://metager.de/meta/meta.ger3?focus=web&eingabe=" + subStr); } else if (text.startsWith(".g ")) { mWebView.loadUrl("https://github.com/search?utf8=&q=" + subStr); } else if (text.startsWith(".s ")) { if (Locale.getDefault().getLanguage().contentEquals("de")) { mWebView.loadUrl( "https://startpage.com/do/search?query=" + subStr + "&lui=deutsch&l=deutsch"); } else { mWebView.loadUrl("https://startpage.com/do/search?query=" + subStr); } } else if (text.startsWith(".G ")) { if (Locale.getDefault().getLanguage().contentEquals("de")) { mWebView.loadUrl("https://www.google.de/search?&q=" + subStr); } else { mWebView.loadUrl("https://www.google.com/search?&q=" + subStr); } } else if (text.startsWith(".y ")) { if (Locale.getDefault().getLanguage().contentEquals("de")) { mWebView.loadUrl("https://www.youtube.com/results?hl=de&gl=DE&search_query=" + subStr); } else { mWebView.loadUrl("https://www.youtube.com/results?search_query=" + subStr); } } else if (text.startsWith(".d ")) { if (Locale.getDefault().getLanguage().contentEquals("de")) { mWebView.loadUrl("https://duckduckgo.com/?q=" + subStr + "&kl=de-de&kad=de_DE&k1=-1&kaj=m&kam=osm&kp=-1&kak=-1&kd=1&t=h_&ia=web"); } else { mWebView.loadUrl("https://duckduckgo.com/?q=" + subStr); } } else { if (searchEngine.contains("https://duckduckgo.com/?q=")) { if (Locale.getDefault().getLanguage().contentEquals("de")) { mWebView.loadUrl("https://duckduckgo.com/?q=" + text + "&kl=de-de&kad=de_DE&k1=-1&kaj=m&kam=osm&kp=-1&kak=-1&kd=1&t=h_&ia=web"); } else { mWebView.loadUrl("https://duckduckgo.com/?q=" + text); } } else if (searchEngine.contains("https://metager.de/meta/meta.ger3?focus=web&eingabe=")) { if (Locale.getDefault().getLanguage().contentEquals("de")) { mWebView.loadUrl("https://metager.de/meta/meta.ger3?focus=web&eingabe=" + text); } else { mWebView.loadUrl("https://metager.de/meta/meta.ger3?focus=web&eingabe=" + text + "&focus=web&encoding=utf8&lang=eng"); } } else if (searchEngine.contains("https://startpage.com/do/search?query=")) { if (Locale.getDefault().getLanguage().contentEquals("de")) { mWebView.loadUrl( "https://startpage.com/do/search?query=" + text + "&lui=deutsch&l=deutsch"); } else { mWebView.loadUrl("https://startpage.com/do/search?query=" + text); } } else { mWebView.loadUrl(searchEngine + text); } } } } if (id == R.id.action_history) { helper_main.switchToActivity(Browser.this, Popup_history.class, "", false); } if (id == R.id.action_search3) { helper_editText.editText_searchWeb(editText, Browser.this); } if (id == R.id.action_pass) { helper_main.switchToActivity(Browser.this, Popup_pass.class, "", false); sharedPref.edit().putString("pass_copy_url", mWebView.getUrl()).apply(); sharedPref.edit().putString("pass_copy_title", mWebView.getTitle()).apply(); } if (id == R.id.action_toggle) { sharedPref.edit().putString("started", "yes").apply(); String link = mWebView.getUrl(); int domainInt = link.indexOf("//") + 2; final String domain = link.substring(domainInt, link.indexOf('/', domainInt)); final String whiteList = sharedPref.getString("whiteList", ""); AlertDialog.Builder builder = new AlertDialog.Builder(Browser.this); View dialogView = View.inflate(Browser.this, R.layout.dialog_toggle, null); Switch sw_java = (Switch) dialogView.findViewById(R.id.switch1); Switch sw_pictures = (Switch) dialogView.findViewById(R.id.switch2); Switch sw_location = (Switch) dialogView.findViewById(R.id.switch3); Switch sw_cookies = (Switch) dialogView.findViewById(R.id.switch4); final ImageButton whiteList_js = (ImageButton) dialogView.findViewById(R.id.imageButton_js); if (whiteList.contains(domain)) { whiteList_js.setImageResource(R.drawable.check_green); } else { whiteList_js.setImageResource(R.drawable.close_red); } if (sharedPref.getString("java_string", "True").equals(getString(R.string.app_yes))) { sw_java.setChecked(true); } else { sw_java.setChecked(false); } if (sharedPref.getString("pictures_string", "True").equals(getString(R.string.app_yes))) { sw_pictures.setChecked(true); } else { sw_pictures.setChecked(false); } if (sharedPref.getString("loc_string", "True").equals(getString(R.string.app_yes))) { sw_location.setChecked(true); } else { sw_location.setChecked(false); } if (sharedPref.getString("cookie_string", "True").equals(getString(R.string.app_yes))) { sw_cookies.setChecked(true); } else { sw_cookies.setChecked(false); } whiteList_js.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (whiteList.contains(domain)) { whiteList_js.setImageResource(R.drawable.close_red); String removed = whiteList.replaceAll(domain, ""); sharedPref.edit().putString("whiteList", removed).apply(); } else { whiteList_js.setImageResource(R.drawable.check_green); sharedPref.edit().putString("whiteList", whiteList + " " + domain).apply(); } } }); sw_java.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { sharedPref.edit().putString("java_string", getString(R.string.app_yes)).apply(); mWebView.getSettings().setJavaScriptEnabled(true); } else { sharedPref.edit().putString("java_string", getString(R.string.app_no)).apply(); mWebView.getSettings().setJavaScriptEnabled(false); } } }); sw_pictures.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { sharedPref.edit().putString("pictures_string", getString(R.string.app_yes)).apply(); mWebView.getSettings().setLoadsImagesAutomatically(true); } else { sharedPref.edit().putString("pictures_string", getString(R.string.app_no)).apply(); mWebView.getSettings().setLoadsImagesAutomatically(false); } } }); sw_location.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { sharedPref.edit().putString("loc_string", getString(R.string.app_yes)).apply(); mWebView.getSettings().setGeolocationEnabled(true); helper_main.grantPermissionsLoc(Browser.this); } else { sharedPref.edit().putString("loc_string", getString(R.string.app_no)).apply(); mWebView.getSettings().setGeolocationEnabled(false); } } }); sw_cookies.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if (isChecked) { sharedPref.edit().putString("cookie_string", getString(R.string.app_yes)).apply(); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setAcceptCookie(true); } else { sharedPref.edit().putString("cookie_string", getString(R.string.app_no)).apply(); CookieManager cookieManager = CookieManager.getInstance(); cookieManager.setAcceptCookie(false); } } }); builder.setView(dialogView); builder.setTitle(R.string.menu_toggle_title); builder.setPositiveButton(R.string.toast_yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { mWebView.reload(); } }); builder.setNegativeButton(R.string.menu_settings, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { sharedPref.edit().putString("pass_copy_url", mWebView.getUrl()).apply(); sharedPref.edit().putString("lastActivity", "browser").apply(); helper_main.switchToActivity(Browser.this, Activity_settings.class, "", true); } }); final AlertDialog dialog = builder.create(); // Display the custom alert dialog on interface dialog.show(); } if (id == R.id.action_save) { final CharSequence[] options = { getString(R.string.menu_save_screenshot), getString(R.string.menu_save_bookmark), getString(R.string.menu_save_readLater), getString(R.string.menu_save_pass), getString(R.string.menu_createShortcut) }; new AlertDialog.Builder(Browser.this) .setPositiveButton(R.string.toast_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }).setItems(options, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { if (options[item].equals(getString(R.string.menu_save_bookmark))) { helper_editText.editText_saveBookmark(editText, Browser.this, mWebView); } if (options[item].equals(getString(R.string.menu_save_pass))) { helper_editText.editText_savePass(Browser.this, mWebView, mWebView.getTitle(), mWebView.getUrl()); } if (options[item].equals(getString(R.string.menu_save_readLater))) { try { final Database_ReadLater db = new Database_ReadLater(Browser.this); db.addBookmark(mWebView.getTitle(), mWebView.getUrl()); db.close(); Snackbar.make(mWebView, R.string.readLater_added, Snackbar.LENGTH_SHORT).show(); } catch (Exception e) { e.printStackTrace(); } } if (options[item].equals(getString(R.string.menu_save_screenshot))) { screenshot(); } if (options[item].equals(getString(R.string.menu_createShortcut))) { Intent i = new Intent(); i.setAction(Intent.ACTION_VIEW); i.setClassName(Browser.this, "de.baumann.browser.Browser"); i.setData(Uri.parse(mWebView.getUrl())); Intent shortcut = new Intent(); shortcut.putExtra("android.intent.extra.shortcut.INTENT", i); shortcut.putExtra("android.intent.extra.shortcut.NAME", "THE NAME OF SHORTCUT TO BE SHOWN"); shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, mWebView.getTitle()); shortcut.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource .fromContext(Browser.this.getApplicationContext(), R.mipmap.ic_launcher)); shortcut.setAction("com.android.launcher.action.INSTALL_SHORTCUT"); Browser.this.sendBroadcast(shortcut); Snackbar.make(mWebView, R.string.menu_createShortcut_success, Snackbar.LENGTH_SHORT) .show(); } } }).show(); } if (id == R.id.action_share) { final CharSequence[] options = { getString(R.string.menu_share_screenshot), getString(R.string.menu_share_link), getString(R.string.menu_share_link_copy) }; new AlertDialog.Builder(Browser.this) .setPositiveButton(R.string.toast_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { dialog.cancel(); } }).setItems(options, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int item) { if (options[item].equals(getString(R.string.menu_share_link))) { Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("text/plain"); sharingIntent.putExtra(Intent.EXTRA_SUBJECT, mWebView.getTitle()); sharingIntent.putExtra(Intent.EXTRA_TEXT, mWebView.getUrl()); startActivity( Intent.createChooser(sharingIntent, (getString(R.string.app_share_link)))); } if (options[item].equals(getString(R.string.menu_share_screenshot))) { screenshot(); if (shareFile.exists()) { Intent sharingIntent = new Intent(Intent.ACTION_SEND); sharingIntent.setType("image/png"); sharingIntent.putExtra(Intent.EXTRA_SUBJECT, mWebView.getTitle()); sharingIntent.putExtra(Intent.EXTRA_TEXT, mWebView.getUrl()); Uri bmpUri = Uri.fromFile(shareFile); sharingIntent.putExtra(Intent.EXTRA_STREAM, bmpUri); startActivity(Intent.createChooser(sharingIntent, (getString(R.string.app_share_screenshot)))); } } if (options[item].equals(getString(R.string.menu_share_link_copy))) { String url = mWebView.getUrl(); ClipboardManager clipboard = (ClipboardManager) Browser.this .getSystemService(Context.CLIPBOARD_SERVICE); clipboard.setPrimaryClip(ClipData.newPlainText("text", url)); Snackbar.make(mWebView, R.string.context_linkCopy_toast, Snackbar.LENGTH_SHORT) .show(); } } }).show(); } if (id == R.id.action_downloads) { String startDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) .getPath(); helper_main.openFilePicker(Browser.this, mWebView, startDir); } if (id == R.id.action_searchSite) { mWebView.stopLoading(); helper_editText.editText_FocusChange_searchSite(editText, Browser.this); helper_editText.editText_searchSite(editText, Browser.this, mWebView); } if (id == R.id.action_search2) { String text = editText.getText().toString(); if (text.startsWith(getString(R.string.app_search))) { helper_editText.editText_searchSite(editText, Browser.this, mWebView); } else { mWebView.findAllAsync(text); helper_editText.hideKeyboard(Browser.this, editText, 1, getString(R.string.app_search) + " " + text, getString(R.string.app_search_hint_site)); } } if (id == R.id.action_prev) { mWebView.findNext(false); } if (id == R.id.action_next) { mWebView.findNext(true); } if (id == R.id.action_cancel) { helper_editText.editText_FocusChange(editText, Browser.this); helper_editText.editText_EditorAction(editText, Browser.this, mWebView); helper_editText.hideKeyboard(Browser.this, editText, 0, mWebView.getTitle(), getString(R.string.app_search_hint)); } if (id == R.id.action_save_bookmark) { helper_editText.editText_saveBookmark_save(editText, Browser.this, mWebView); } return super.onOptionsItemSelected(item); }
From source file:com.ebridgevas.android.ebridgeapp.messaging.mqttservice.MqttAndroidClient.java
/** * Connects to an MQTT server using the specified options. * <p>/*from w w w .j a v a 2s.c o m*/ * The server to connect to is specified on the constructor. It is * recommended to call {@link #setCallback(MqttCallback)} prior to * connecting in order that messages destined for the client can be accepted * as soon as the client is connected. * </p> * <p> * The method returns control before the connect completes. Completion can * be tracked by: * <ul> * <li>Waiting on the returned token {@link IMqttToken#waitForCompletion()} * or</li> * <li>Passing in a callback {@link IMqttActionListener}</li> * </ul> * </p> * * @param options * a set of connection parameters that override the defaults. * @param userContext * optional object for used to pass context to the callback. Use * null if not required. * @param callback * optional listener that will be notified when the connect * completes. Use null if not required. * @return token used to track and wait for the connect to complete. The * token will be passed to any callback that has been set. * @throws MqttException * for any connected problems, including communication errors */ @Override public IMqttToken connect(MqttConnectOptions options, Object userContext, IMqttActionListener callback) throws MqttException { IMqttToken token = new MqttTokenAndroid(this, userContext, callback); connectOptions = options; connectToken = token; /* * The actual connection depends on the service, which we start and bind * to here, but which we can't actually use until the serviceConnection * onServiceConnected() method has run (asynchronously), so the * connection itself takes place in the onServiceConnected() method */ if (mqttService == null) { // First time - must bind to the service Intent serviceStartIntent = new Intent(); serviceStartIntent.setClassName(myContext, SERVICE_NAME); Object service = myContext.startService(serviceStartIntent); if (service == null) { IMqttActionListener listener = token.getActionCallback(); if (listener != null) { listener.onFailure(token, new RuntimeException("cannot start service " + SERVICE_NAME)); } } // We bind with BIND_SERVICE_FLAG (0), leaving us the manage the lifecycle // until the last time it is stopped by a call to stopService() myContext.bindService(serviceStartIntent, serviceConnection, Context.BIND_AUTO_CREATE); if (!receiverRegistered) registerReceiver(this); } else { pool.execute(new Runnable() { @Override public void run() { doConnect(); //Register receiver to show shoulder tap. if (!receiverRegistered) registerReceiver(MqttAndroidClient.this); } }); } return token; }
From source file:com.google.appinventor.components.runtime.Form.java
protected void startNewForm(String nextFormName, Object startupValue) { Log.i(LOG_TAG, "startNewForm:" + nextFormName); Intent activityIntent = new Intent(); // Note that the following is dependent on form generated class names being the same as // their form names and all forms being in the same package. activityIntent.setClassName(this, getPackageName() + "." + nextFormName); String functionName = (startupValue == null) ? "open another screen" : "open another screen with start value"; String jValue;/*www . ja v a2 s .c om*/ if (startupValue != null) { Log.i(LOG_TAG, "StartNewForm about to JSON encode:" + startupValue); jValue = jsonEncodeForForm(startupValue, functionName); Log.i(LOG_TAG, "StartNewForm got JSON encoding:" + jValue); } else { jValue = ""; } activityIntent.putExtra(ARGUMENT_NAME, jValue); // Save the nextFormName so that it can be passed to the OtherScreenClosed event in the // future. this.nextFormName = nextFormName; Log.i(LOG_TAG, "about to start new form" + nextFormName); try { Log.i(LOG_TAG, "startNewForm starting activity:" + activityIntent); startActivityForResult(activityIntent, SWITCH_FORM_REQUEST_CODE); } catch (ActivityNotFoundException e) { dispatchErrorOccurredEvent(this, functionName, ErrorMessages.ERROR_SCREEN_NOT_FOUND, nextFormName); } }
From source file:com.mantz_it.rfanalyzer.MainActivity.java
@Override protected void onDestroy() { super.onDestroy(); // close source if (source != null && source.isOpen()) source.close();// w ww.jav a 2 s . c om // stop logging: if (logcat != null) { try { logcat.destroy(); logcat.waitFor(); Log.i(LOGTAG, "onDestroy: logcat exit value: " + logcat.exitValue()); } catch (Exception e) { Log.e(LOGTAG, "onDestroy: couldn't stop logcat: " + e.getMessage()); } } // shut down RTL2832U driver if running: if (running && Integer.valueOf(preferences.getString(getString(R.string.pref_sourceType), "1")) == RTLSDR_SOURCE && !preferences.getBoolean(getString(R.string.pref_rtlsdr_externalServer), false)) { try { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setClassName("marto.rtl_tcp_andro", "com.sdrtouch.rtlsdr.DeviceOpenActivity"); intent.setData(Uri.parse("iqsrc://-x")); // -x is invalid. will cause the driver to shut down (if running) startActivity(intent); } catch (ActivityNotFoundException e) { Log.e(LOGTAG, "onDestroy: RTL2832U is not installed"); } } }
From source file:mobi.omegacentauri.ptimer.PTimerEditActivity.java
private void chooseContactForRingtone(Uri uri) { try {//from ww w . ja va2 s . co m Intent intent = new Intent(Intent.ACTION_EDIT, uri); intent.setClassName("mobi.omegacentauri.ptimer", "mobi.omegacentauri.ptimer.ChooseContactActivity"); startActivityForResult(intent, REQUEST_CODE_CHOOSE_CONTACT); } catch (Exception e) { Log.e("Ringdroid", "Couldn't open Choose Contact window"); } }
From source file:com.SpeechEd.SpeechEdEditActivity.java
private void chooseContactForRingtone(Uri uri) { try {/* ww w . j av a2 s.c om*/ Intent intent = new Intent(Intent.ACTION_EDIT, uri); intent.setClassName("com.SpeechEd", "com.SpeechEd.ChooseContactActivity"); startActivityForResult(intent, REQUEST_CODE_CHOOSE_CONTACT); } catch (Exception e) { Log.e("Speech-Ed", "Couldn't open Choose Contact window"); } }