List of usage examples for android.content Intent getStringArrayListExtra
public ArrayList<String> getStringArrayListExtra(String name)
From source file:eu.power_switch.gui.fragment.configure_gateway.ConfigureGatewayDialogPage2Fragment.java
@Nullable @Override//from w ww .ja v a2 s . c o m public View onCreateView(final LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { rootView = inflater.inflate(R.layout.dialog_fragment_configure_gateway_page_2, container, false); recyclerViewSsids = (RecyclerView) rootView.findViewById(R.id.recyclerView_ssids); ssidRecyclerViewAdapter = new SsidRecyclerViewAdapter(getActivity(), ssids); recyclerViewSsids.setAdapter(ssidRecyclerViewAdapter); ssidRecyclerViewAdapter.setOnDeleteClickListener(new SsidRecyclerViewAdapter.OnItemClickListener() { @Override public void onItemClick(View itemView, final int position) { new AlertDialog.Builder(getContext()).setTitle(R.string.delete).setMessage(R.string.are_you_sure) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { try { ssids.remove(position); ssidRecyclerViewAdapter.notifyDataSetChanged(); notifyConfigurationChanged(); } catch (Exception e) { StatusMessageHandler.showErrorMessage(getActivity(), e); } } }).setNeutralButton(android.R.string.cancel, null).show(); } }); StaggeredGridLayoutManager layoutManager = new StaggeredGridLayoutManager(1, StaggeredGridLayoutManager.VERTICAL); recyclerViewSsids.setLayoutManager(layoutManager); addSsidFAB = (FloatingActionButton) rootView.findViewById(R.id.add_ssid_fab); addSsidFAB.setImageDrawable(IconicsHelper.getAddIcon(getActivity(), ContextCompat.getColor(getActivity(), android.R.color.white))); final Fragment fragment = this; addSsidFAB.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AddSsidDialog addSsidDialog = new AddSsidDialog(); addSsidDialog.setTargetFragment(fragment, 0); addSsidDialog.show(getFragmentManager(), null); } }); broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (LocalBroadcastConstants.INTENT_GATEWAY_SSID_ADDED.equals(intent.getAction())) { ArrayList<String> newSsids = intent.getStringArrayListExtra(AddSsidDialog.KEY_SSID); ssids.addAll(newSsids); ssidRecyclerViewAdapter.notifyDataSetChanged(); } if (LocalBroadcastConstants.INTENT_GATEWAY_SETUP_CHANGED.equals(intent.getAction())) { currentName = intent.getStringExtra("name"); currentModel = intent.getStringExtra("model"); currentLocalAddress = intent.getStringExtra("localAddress"); currentLocalPort = intent.getIntExtra("localPort", -1); currentWanAddress = intent.getStringExtra("wanAddress"); currentWanPort = intent.getIntExtra("wanPort", -1); } notifyConfigurationChanged(); } }; Bundle args = getArguments(); if (args != null && args.containsKey(ConfigureGatewayDialog.GATEWAY_ID_KEY)) { gatewayId = args.getLong(ConfigureGatewayDialog.GATEWAY_ID_KEY); initializeGatewayData(gatewayId); } return rootView; }
From source file:com.surveyorexpert.TalkToMe.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == SPEECH_REQUEST_CODE) { if (resultCode == RESULT_OK) { ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); if (matches.size() == 0) { tts.speak("Heard nothing", TextToSpeech.QUEUE_FLUSH, null); } else { String mostLikelyThingHeard = matches.get(0); String magicWord = this.getResources().getString(R.string.magicword); if (mostLikelyThingHeard.equals(magicWord)) { tts.speak("You said the magic word!", TextToSpeech.QUEUE_FLUSH, null); } else { // tts.speak("Recognised " + mostLikelyThingHeard + " Is that OK", TextToSpeech.QUEUE_FLUSH, null); gotMessage = mostLikelyThingHeard; tts.speak(gotMessage + " OK?", TextToSpeech.QUEUE_FLUSH, null); //intent.putExtra("description",mostLikelyThingHeard); }/* w ww. ja v a2 s .c o m*/ } result.setText("heard: " + matches); // Toast.makeText(getBaseContext(),"TalkToMe Done " + gotMessage, Toast.LENGTH_LONG).show(); } else { Log.d(TAG, "result NOT ok"); } } super.onActivityResult(requestCode, resultCode, data); }
From source file:org.apache.cordova.nodialogspeechrecognizer.SpeechRecognizer.java
/** * Handle the results from the recognition activity. *//*from ww w . jav a2 s . c om*/ @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == Activity.RESULT_OK) { // Fill the list view with the strings the recognizer thought it could // have heard ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); returnSpeechResults(matches); } else { // Failure - Let the caller know this.callbackContext.error(Integer.toString(resultCode)); } super.onActivityResult(requestCode, resultCode, data); }
From source file:agricultural.nxt.agriculturalsupervision.Activity.intercourse.SupplierAddUpdateActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); List<String> photos = null; switch (requestCode) { case 1://from w w w .j a va 2 s . c o m if (data != null) { photos = data.getStringArrayListExtra(PhotoPicker.KEY_SELECTED_PHOTOS); } selectedPhotos1.clear(); if (photos != null) { selectedPhotos1.addAll(photos); img1.setVisibility(View.VISIBLE); Glide.with(this).load(selectedPhotos1.get(0)).crossFade().into(img1); } break; case 2: if (data != null) { photos = data.getStringArrayListExtra(PhotoPicker.KEY_SELECTED_PHOTOS); } selectedPhotos2.clear(); if (photos != null) { selectedPhotos2.addAll(photos); img2.setVisibility(View.VISIBLE); Glide.with(this).load(selectedPhotos2.get(0)).crossFade().into(img2); } break; } }
From source file:comm.lib.photoview.PhotoViewActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mViewPager = new HackyViewPager(this); setContentView(R.layout.show_image_vp); FrameLayout vgViewPager = (FrameLayout) findViewById(R.id.show_image_vg_viewpager); indexTextView = (TextView) findViewById(R.id.show_image_index); back = (ImageView) findViewById(R.id.show_image_back); downloadToolBar = (RelativeLayout) findViewById(R.id.show_image_download); downLoadProgress = (ProgressBar) findViewById(R.id.show_image_progressbar); original = (TextView) findViewById(R.id.show_image_original); original.setOnClickListener(this); note = (TextView) findViewById(R.id.show_image_note); vgViewPager.addView(mViewPager);//from w w w. j av a 2s.c om Intent intent = getIntent(); if (intent != null) { currIndex = intent.getIntExtra(CURR_INDEX, 0); sDrawables = intent.getStringArrayListExtra(URLS); } else { this.finish(); } mViewPager.setAdapter(new SamplePagerAdapter()); mViewPager.setCurrentItem(currIndex); indexTextView.setText(String.valueOf(currIndex + 1)); mViewPager.setOnPageChangeListener(this); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { PhotoViewActivity.this.finish(); } }); downloadManager = new DownloadManager(this); iSql = new ISqlImpl(this); initDownLoadTask(currIndex); }
From source file:com.google.cast.sample.helloworld.MainActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) { ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); if (matches.size() > 0) { Log.d(TAG, matches.get(0));//from w w w. j av a2 s.co m sendMessage("{\"key\": \"search\", \"value\": \"" + matches.get(0) + "\"}"); } } super.onActivityResult(requestCode, resultCode, data); }
From source file:org.exobel.routerkeygen.AutoConnectService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent == null) { stopSelf();/*from www . j ava 2s.c om*/ return START_NOT_STICKY; } attempts = 0; currentNetworkId = -1; network = intent.getParcelableExtra(SCAN_RESULT); keys = intent.getStringArrayListExtra(KEY_LIST); final ConnectivityManager connManager = (ConnectivityManager) getSystemService(CONNECTIVITY_SERVICE); final NetworkInfo mWifi = connManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI); if (mWifi.isConnected()) { if (wifi.disconnect()) { // besides disconnecting, we clean any previous configuration Wifi.cleanPreviousConfiguration(wifi, network, network.capabilities); mNotificationManager.notify(UNIQUE_ID, createProgressBar(getString(R.string.app_name), getString(R.string.not_auto_connect_waiting), 0)); final Handler handler = new Handler(); handler.postDelayed(new Runnable() { public void run() { tryingConnection(); } }, DISCONNECT_WAITING_TIME); } else { mNotificationManager.notify(UNIQUE_ID, getSimple(getString(R.string.msg_error), getString(R.string.msg_error_key_testing)) .build()); stopSelf(); return START_NOT_STICKY; } } else { Wifi.cleanPreviousConfiguration(wifi, network, network.capabilities); tryingConnection(); } return START_STICKY; }
From source file:com.tdispatch.passenger.fragment.SearchAddressFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { if ((requestCode == Const.RequestCode.VOICE_RECOGNITION) && (resultCode == Activity.RESULT_OK)) { ArrayList<String> matches = intent.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); WebnetLog.d("size: " + matches.size()); if (matches.size() > 0) { WebnetLog.d("1st: " + matches.get(0)); EditText et = (EditText) mFragmentView.findViewById(R.id.address); et.setText(matches.get(0));/*from w w w. j a v a 2 s . c o m*/ } } }
From source file:com.sonnychen.aviationhk.LightboxActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // go full screen this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); Intent intent = getIntent(); if (intent == null || (!intent.hasExtra(INTENT_URLS_PARAM))) { finish();//from ww w . j av a2s. c om return; } setContentView(R.layout.activity_lightbox); // load images from intent mURLs = intent.getStringArrayListExtra(INTENT_URLS_PARAM); mLightBox = (ExtendedViewPager) findViewById(R.id.lightbox); mImagesAdapter = new ImagesAdapter(); mLightBox.setAdapter(mImagesAdapter); mLightBox.setCurrentItem(intent.getIntExtra(INTENT_INDEX_PARAM, 0)); Log.v(INTENT_URLS_PARAM, mURLs.toString()); Log.v(INTENT_INDEX_PARAM, mURLs.toString()); }
From source file:com.justplay1.shoppist.features.search.SearchFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQ_CODE_SPEECH_INPUT) { if (resultCode == Activity.RESULT_OK && null != data) { ArrayList<String> result = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); searchView.setActivated(true); searchView.setText(result.get(0)); }/* w w w . j a v a2s.c o m*/ } }