List of usage examples for android.content Intent putStringArrayListExtra
public @NonNull Intent putStringArrayListExtra(String name, ArrayList<String> value)
From source file:ee.ioc.phon.android.speak.RecognizerIntentActivity.java
/** * <p>Returns the transcription results (matches) to the caller, * or sends them to the pending intent, or performs a web search.</p> * * <p>If a pending intent was specified then use it. This is the case with * applications that use the standard search bar (e.g. Google Maps and YouTube).</p> * * <p>Otherwise. If there was no caller (i.e. we cannot return the results), or * the caller asked us explicitly to perform "web search", then do that, possibly * disambiguating the results or redoing the recognition. * This is the case when K6nele was launched from its launcher icon (i.e. no caller), * or from a browser app.// ww w. j a va2 s. c o m * (Note that trying to return the results to Google Chrome does not seem to work.)</p> * * <p>Otherwise. Just return the results to the caller.</p> * * <p>Note that we assume that the given list of matches contains at least one * element.</p> * * @param handler message handler * @param matches transcription results (one or more hypotheses) */ private void returnOrForwardMatches(final Handler handler, ArrayList<String> matches) { // Throw away matches that the user is not interested in int maxResults = mExtras.getInt(RecognizerIntent.EXTRA_MAX_RESULTS); if (maxResults > 0 && matches.size() > maxResults) { matches.subList(maxResults, matches.size()).clear(); } if (mExtraResultsPendingIntent == null) { if (getCallingActivity() == null || RecognizerIntent.ACTION_WEB_SEARCH.equals(getIntent().getAction()) || mExtras.getBoolean(RecognizerIntent.EXTRA_WEB_SEARCH_ONLY)) { handleResultsByWebSearch(this, handler, matches); return; } else { setResultIntent(handler, matches); } } else { Bundle bundle = mExtras.getBundle(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT_BUNDLE); if (bundle == null) { bundle = new Bundle(); } String match = matches.get(0); //mExtraResultsPendingIntentBundle.putString(SearchManager.QUERY, match); Intent intent = new Intent(); intent.putExtras(bundle); // This is for Google Maps, YouTube, ... intent.putExtra(SearchManager.QUERY, match); // This is for SwiftKey X, ... intent.putStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS, matches); String message = ""; if (matches.size() == 1) { message = match; } else { message = matches.toString(); } // Display a toast with the transcription. handler.sendMessage( createMessage(MSG_TOAST, String.format(getString(R.string.toastForwardedMatches), message))); try { mExtraResultsPendingIntent.send(this, Activity.RESULT_OK, intent); } catch (CanceledException e) { handler.sendMessage(createMessage(MSG_TOAST, e.getMessage())); } } finish(); }
From source file:com.doplgangr.secrecy.views.FilesListFragment.java
void addFile() { // Use the GET_CONTENT intent from the utility class Intent target = com.ipaulpro.afilechooser.utils.FileUtils.createGetContentIntent(); // Create the chooser Intent Intent intent = Intent.createChooser(target, getString(R.string.Dialog_header__pick_file)); try {/*from w w w .j a v a 2s. c o m*/ startActivityForResult(intent, REQUEST_CODE); FilesActivity.onPauseDecision.startActivity(); } catch (ActivityNotFoundException e) { intent = new Intent(context, FileChooserActivity.class); intent.putStringArrayListExtra(FileChooserActivity.EXTRA_FILTER_INCLUDE_EXTENSIONS, INCLUDE_EXTENSIONS_LIST); intent.putExtra(FileChooserActivity.EXTRA_SELECT_FOLDER, false); startActivityForResult(intent, REQUEST_CODE); FilesActivity.onPauseDecision.startActivity(); } }
From source file:de.blinkt.openvpn.bluetooth.service.UartService.java
private void broadcastUpdate(final String action, final BluetoothGattCharacteristic characteristic) { final Intent intent = new Intent(action); if (TX_CHAR_UUID1.equals(characteristic.getUuid())) { byte[] txValue = characteristic.getValue(); int lengthData = (txValue[1] & 0x7f) + 1; int dataStatue = txValue[1] & 0x80; String messageFromBlueTooth = HexStringExchangeBytesUtil.bytesToHexString(characteristic.getValue()); Log.e("UartService", messageFromBlueTooth); if (lengthData == 1 && dataStatue == 0x80) { //TODO ?? // messages.add(messageFromBlueTooth); ArrayList<String> onePackagemessage = new ArrayList<>(); onePackagemessage.add(messageFromBlueTooth); intent.putStringArrayListExtra(EXTRA_DATA, onePackagemessage); LocalBroadcastManager.getInstance(ICSOpenVPNApplication.getContext()).sendBroadcast(intent); return; } else {//from ww w . j a v a 2 s .c om //TODO ? if (TextUtils.isEmpty(messageFromBlueTooth)) { return; } if (messages == null) { messages = new ArrayList<>(); } messages.add(messageFromBlueTooth); if (messages.size() < lengthData) { if (dataStatue == 0x80) { isWholeDataPackage = true; } return; } if (isWholeDataPackage || dataStatue == 0x80) { isWholeDataPackage = false; sortMessage(); intent.putStringArrayListExtra(EXTRA_DATA, messages); Log.e("UartService", messages.toString()); LocalBroadcastManager.getInstance(ICSOpenVPNApplication.getContext()).sendBroadcast(intent); } } // intent.putExtra(EXTRA_DATA, messageFromBlueTooth); // if(messages.size()==0){ // return; // } } }
From source file:edu.asu.msse.sgowdru.moviemediaplayerrpc.MainActivity.java
public void processData() { //Hashmap storing the List for each genre movielist = getGenreMovies();/*from w w w . j av a2 s. co m*/ //Get the id for ExpandableListView and set the movielist for it using Adapter expandableView = (ExpandableListView) findViewById(R.id.exp_list); //Call the MovieListAdapter constructor which will create the generated view from JSON file adapter = new MovieListAdapter(this, heading, movielist); expandableView.setAdapter(adapter); //Expand all genre by default, so we can see movies under each genre by default for (int i = 0; i < adapter.getGroupCount(); i++) expandableView.expandGroup(i); //On click on each movie in any genre opens new Intent for that movie expandableView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { Intent intent = new Intent(getApplicationContext(), MovieDetails.class); ArrayList<String> fieldDetails = new ArrayList<>(); String str = heading.get(groupPosition); List<String> ls = movielist.get(str); //Fetch the movie name String movieName = ls.get(childPosition); //Get Movie details of a movie name try { cur = crsDB.rawQuery( "select Title, Genre, Years, Rated, Actors, VideoFile from Movies where Title = ?;", new String[] { movieName }); //Move to the result cur.moveToNext(); //Read all the fields fieldDetails.add(cur.getString(0)); fieldDetails.add(cur.getString(1)); fieldDetails.add(cur.getString(2)); fieldDetails.add(cur.getString(3)); fieldDetails.add(cur.getString(4)); fieldDetails.add(cur.getString(5)); } catch (Exception e) { android.util.Log.w(getClass().getSimpleName(), e.getMessage()); } //Send the acquired details to other activity for display intent.putStringArrayListExtra("fields", fieldDetails); //Launch the activity startActivity(intent); return true; } }); }
From source file:net.networksaremadeofstring.rhybudd.RhybuddHome.java
public void ManageEvent(final String EventID, final int Position, final int viewID) { AlertDialog.Builder alertbox = new AlertDialog.Builder(this); alertbox.setMessage("What would you like to do?"); alertbox.setPositiveButton("Ack Event", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { AcknowledgeSingleEvent(Position); }//from w ww.j av a 2 s . c om }); alertbox.setNeutralButton("View Event", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { /*Intent ViewEventIntent = new Intent(RhybuddHome.this, ViewZenossEvent.class); try { ViewEventIntent.putExtra("EventID", EventID); ViewEventIntent.putExtra("Count", listOfZenossEvents.get(Position).getCount()); ViewEventIntent.putExtra("Device", listOfZenossEvents.get(Position).getDevice()); ViewEventIntent.putExtra("EventState", listOfZenossEvents.get(Position).getEventState()); ViewEventIntent.putExtra("FirstTime", listOfZenossEvents.get(Position).getfirstTime()); ViewEventIntent.putExtra("LastTime", listOfZenossEvents.get(Position).getlastTime()); ViewEventIntent.putExtra("Severity", listOfZenossEvents.get(Position).getSeverity()); ViewEventIntent.putExtra("Summary", listOfZenossEvents.get(Position).getSummary()); } catch(Exception e) { } RhybuddHome.this.startActivity(ViewEventIntent);*/ Intent ViewEventIntent = new Intent(RhybuddHome.this, ViewZenossEventActivity.class); ViewEventIntent.putExtra("EventID", EventID); ArrayList<String> EventNames = new ArrayList<String>(); ArrayList<String> EVIDs = new ArrayList<String>(); for (ZenossEvent evt : listOfZenossEvents) { EventNames.add(evt.getDevice()); EVIDs.add(evt.getEVID()); } ViewEventIntent.putStringArrayListExtra("eventnames", EventNames); ViewEventIntent.putStringArrayListExtra("evids", EVIDs); RhybuddHome.this.startActivityForResult(ViewEventIntent, 20); } }); alertbox.setNegativeButton("Nothing", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { } }); alertbox.show(); }
From source file:org.de.jmg.learn.SettingsActivity.java
private void ShowSoundsDialog() { spnSounds.blnDontCallOnClick = true; SoundSetting item = Sounds.getItem(spnSounds.getSelectedItemPosition()); File F = new File(item.SoundPath); String dir = _main.SoundDir;/*from ww w .ja v a 2 s .c o m*/ if (F.exists()) dir = F.getParent(); Intent intent = new Intent(_main, FileChooser.class); ArrayList<String> extensions = new ArrayList<String>(); extensions.add(".wav"); extensions.add(".mp3"); extensions.add(".ogg"); extensions.add(".flv"); intent.putStringArrayListExtra("filterFileExtension", extensions); intent.putExtra("DefaultDir", dir); _main.startActivityForResult(intent, FILE_CHOOSERSOUND); }
From source file:cm.aptoide.pt.ApkInfo.java
private void startImagePagerActivity(int position) { Intent intent = new Intent(this, ScreenshotsViewer.class); intent.putStringArrayListExtra("url", imageUrls); intent.putExtra("position", position); intent.putExtra("hashCode", hashCode + ".hd"); startActivity(intent);// www . j av a2 s . co m }
From source file:net.networksaremadeofstring.rhybudd.ViewZenossEventsListActivity.java
@Override public void onItemSelected(final ZenossEvent event, final int position) { try {/*from w w w . j ava 2 s. c om*/ if (mTwoPane) { // In two-pane mode, show the detail view in this activity by // adding or replacing the detail fragment using a // fragment transaction. Bundle arguments = new Bundle(); arguments.putString("EventID", event.getEVID()); arguments.putString("EventTitle", event.getDevice()); arguments.putInt("EventCount", event.getCount()); arguments.putBoolean(ViewZenossDeviceFragment.ARG_2PANE, true); arguments.putInt("position", position); ViewZenossEventFragment fragment = new ViewZenossEventFragment(); fragment.setArguments(arguments); getSupportFragmentManager().beginTransaction().replace(R.id.event_detail_container, fragment) .commit(); } else { AlertDialog.Builder alertbox = new AlertDialog.Builder(this); alertbox.setTitle("Event Management"); alertbox.setMessage("What would you like to do?"); alertbox.setPositiveButton("Acknowledge", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { //AcknowledgeSingleEvent(position); ViewZenossEventsListFragment listFrag = (ViewZenossEventsListFragment) getSupportFragmentManager() .findFragmentById(R.id.events_list); //Log.e("Activity","ack with position " + Integer.toString(position)); listFrag.acknowledgeSingleEvent(position); } }); alertbox.setNeutralButton("View Details", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { Intent ViewEventIntent = new Intent(ViewZenossEventsListActivity.this, ViewZenossEventActivity.class); ViewEventIntent.putExtra("EventID", event.getEVID()); ViewEventIntent.putExtra("position", position); ViewEventIntent.putExtra("EventTitle", event.getDevice()); ViewEventIntent.putExtra("EventCount", event.getCount()); ArrayList<String> EventNames = new ArrayList<String>(); ArrayList<String> EVIDs = new ArrayList<String>(); ViewZenossEventsListFragment listFrag = (ViewZenossEventsListFragment) getSupportFragmentManager() .findFragmentById(R.id.events_list); List<ZenossEvent> listOfZenossEvents = listFrag.getListOfEvents(); for (ZenossEvent evt : listOfZenossEvents) { EventNames.add(evt.getDevice()); EVIDs.add(evt.getEVID()); } ViewEventIntent.putStringArrayListExtra("eventnames", EventNames); ViewEventIntent.putStringArrayListExtra("evids", EVIDs); ViewZenossEventsListActivity.this.startActivity(ViewEventIntent); } }); alertbox.setNegativeButton("Nothing", new DialogInterface.OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { } }); alertbox.show(); } } catch (Exception e) { //Damn I'm lazy BugSenseHandler.sendExceptionMessage("ViewZenossEventsListActivity", "onItemSelected", e); } }
From source file:com.gizwits.smartlight.activity.MainListActivity.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.ivBack: case R.id.ivMenu: Log.i(TAG, "back key is pressed"); mView.toggle();/*from w w w . j a va 2 s . co m*/ break; case R.id.btnSwitch: //?0.6?????--600 if (switchTime + 1000 > System.currentTimeMillis()) { return; } switchTime = System.currentTimeMillis(); if (!selectGroup.equals("") && selectGroup != null) { Log.i(TAG, "operate on group=" + selectGroup); //?ledList if (btnSwitch.getText().toString().equals("close")) { mCenter.cSwitchOnGroup(selectGroup, false); } else { mCenter.cSwitchOnGroup(selectGroup, true); } } else { //? if (btnSwitch.getText().toString().equals("close")) { mCenter.cSwitchOn(selectSubDevice, false); } else { mCenter.cSwitchOn(selectSubDevice, true); } } break; case R.id.ifttt: //?? Intent intent = new Intent(MainListActivity.this, EditIfttt.class); intent.putStringArrayListExtra("sceneList", GroupDevice.getAllSceneName(sceneList)); intent.putStringArrayListExtra("ControllerList", GroupDevice.getAllName(ControllerList)); intent.putExtra("did", "" + mXpgWifiDevice.getDid()); startActivity(intent); break; case R.id.black_alpha_bg: bottomClose(); break; case R.id.ivEdit: //? Log.i("showDel", "" + ivDels.size()); bottomClose(); if (ivEdit.getTag().toString().equals("1")) { ivEdit.setImageResource(R.drawable.icon_confirm); ivEdit.setTag("0"); } else { ivEdit.setImageResource(R.drawable.icon_edit_w); ivEdit.setTag("1"); } if (ivDels.size() < 1) { return; } if (ivEdit.getTag().toString().equals("0")) { for (ImageView ivDel : ivDels) { ivDel.setVisibility(View.VISIBLE); } } else { for (ImageView ivDel : ivDels) { ivDel.setVisibility(View.INVISIBLE); } } break; case R.id.btn_addscene: String payload = ""; scene newScene; boolean isIgnore = false; Log.i(TAG, "Click scene button"); newScene = new scene("", "", "", 0); newScene.setValue(Integer.toString(mLightness) + ":" + Integer.toString(mHue) + ":" + Integer.toString(mSaturation)); if (tvEditSceneName.getText().toString().trim().isEmpty()) { if (scene_details.isEmpty()) newScene.setName("scene0"); else newScene.setName("scene" + (scene_details.size())); } else { newScene.setName(tvEditSceneName.getText().toString()); } //If same should not add, need add this logic here.... for (int i = 0; i < scene_details.size(); i++) { if (scene_details.get(i).getValue().equals(newScene.getValue())) { isIgnore = true; Toast.makeText(this, "You have already add the same scene before!", Toast.LENGTH_LONG).show(); Log.i(TAG, "Already have such scene so ignore this action"); } } if (isIgnore) break; // Also send cmd to gateway Log.i(TAG, "Send scene add cmd to gateway"); payload += newScene.getName(); payload += ":"; if (!selectGroup.equals("") && selectGroup != null) { for (int i = 0; i < groupMapList.get(selectGroup).size(); i++) { if (i > 0) payload += ","; payload += groupMapList.get(selectGroup).get(i); } payload += ":"; payload += newScene.getValue(); mCenter.cAddScene(selectGroup, payload); } break; } }