List of usage examples for android.content Intent getStringArrayExtra
public String[] getStringArrayExtra(String name)
From source file:free.yhc.feeder.ChannelListActivity.java
private void onResult_pickPredefinedChannel(int resultCode, Intent data) { if (RESULT_OK != resultCode) return;//from w w w . j a va2 s. co m final String[] urls = data.getStringArrayExtra(PredefinedChannelActivity.KEY_URLS); final String[] iconurls = data.getStringArrayExtra(PredefinedChannelActivity.KEY_ICONURLS); for (int i = 0; i < urls.length; i++) { eAssert(Utils.isValidValue(urls[i])); final String url = urls[i]; final String iconurl = iconurls[i]; // NOTE // Without using 'post', user may feel bad ui response. Environ.getUiHandler().post(new Runnable() { @Override public void run() { addChannel(url, iconurl); } }); } }
From source file:com.jesusla.google.BillingService.java
/** * The {@link BillingReceiver} sends messages to this service using intents. * Each intent has an action and some extra arguments specific to that action. * @param intent the intent containing one of the supported actions * @param startId an identifier for the invocation instance of this service *//*from w w w. j a va 2 s . co m*/ public void handleCommand(Intent intent, int startId) { String action = intent.getAction(); if (Consts.DEBUG) { Log.i(TAG, "handleCommand() action: " + action); } if (Consts.ACTION_CONFIRM_NOTIFICATION.equals(action)) { String[] notifyIds = intent.getStringArrayExtra(Consts.NOTIFICATION_ID); confirmNotifications(startId, notifyIds); } else if (Consts.ACTION_GET_PURCHASE_INFORMATION.equals(action)) { String notifyId = intent.getStringExtra(Consts.NOTIFICATION_ID); getPurchaseInformation(startId, new String[] { notifyId }); } else if (Consts.ACTION_PURCHASE_STATE_CHANGED.equals(action)) { String signedData = intent.getStringExtra(Consts.INAPP_SIGNED_DATA); String signature = intent.getStringExtra(Consts.INAPP_SIGNATURE); purchaseStateChanged(startId, signedData, signature); } else if (Consts.ACTION_RESPONSE_CODE.equals(action)) { long requestId = intent.getLongExtra(Consts.INAPP_REQUEST_ID, -1); int responseCodeIndex = intent.getIntExtra(Consts.INAPP_RESPONSE_CODE, ResponseCode.RESULT_ERROR.ordinal()); ResponseCode responseCode = ResponseCode.valueOf(responseCodeIndex); checkResponseCode(requestId, responseCode); } }
From source file:com.evandroid.musica.MainLyricActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this); int[] themes = new int[] { R.style.Theme_QuickLyric, R.style.Theme_QuickLyric_Dark }; int themeNum = Integer.valueOf(sharedPref.getString("pref_theme", "0")); boolean nightMode = sharedPref.getBoolean("pref_night_mode", false); if (nightMode && NightTimeVerifier.check(this)) setTheme(R.style.Theme_QuickLyric_Night); else//from ww w . j ava 2 s. c o m setTheme(themes[themeNum]); setStatusBarColor(null); setNavBarColor(null); final FragmentManager fragmentManager = getFragmentManager(); setContentView(R.layout.nav_drawer_activity); database = new DatabaseHelper(getApplicationContext()).getReadableDatabase(); DatabaseHelper.setDatabase(database); if (database != null && DatabaseHelper.getColumnsCount(database) <= 6) DatabaseHelper.addMissingColumns(database); Intent intent = getIntent(); String extra = intent.getStringExtra(Intent.EXTRA_TEXT); Lyrics receivedLyrics = getBeamedLyrics(intent); if (receivedLyrics != null) { updateLyricsFragment(0, 0, false, receivedLyrics); } else { String s = intent.getAction(); if ("com.evandroid.music.getLyrics".equals(s)) { String[] metadata = intent.getStringArrayExtra("TAGS"); String artist = metadata[0]; String track = metadata[1]; updateLyricsFragment(0, artist, track); /*} else if (s.equals("android.intent.action.SEND")) { new IdDecoder(this, init(fragmentManager, true)).execute(getIdUrl(extra)); */} else init(fragmentManager, false); } }
From source file:org.deviceconnect.android.localoauth.fragment.ConfirmAuthFragment.java
@Override public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { Intent intent = getActivity().getIntent(); if (intent == null) { getActivity().finish();/*from ww w . j av a2 s . co m*/ return null; } mThreadId = intent.getLongExtra(ConfirmAuthActivity.EXTRA_THREAD_ID, -1); if (mThreadId == -1) { getActivity().finish(); return null; } String applicationName = intent.getStringExtra(ConfirmAuthActivity.EXTRA_APPLICATION_NAME); String packageName = intent.getStringExtra(ConfirmAuthActivity.EXTRA_PACKAGE_NAME); String keyword = intent.getStringExtra(ConfirmAuthActivity.EXTRA_KEYWORD); String[] displayScopes = intent.getStringArrayExtra(ConfirmAuthActivity.EXTRA_DISPLAY_SCOPES); String expirePeriod = toStringExpiredPeriod(); boolean isForPlugin = intent.getBooleanExtra(ConfirmAuthActivity.EXTRA_IS_FOR_DEVICEPLUGIN, true); boolean isAutoFlag = intent.getBooleanExtra(ConfirmAuthActivity.EXTRA_AUTO_FLAG, false); long requestTime = intent.getLongExtra(ConfirmAuthActivity.EXTRA_REQUEST_TIME, System.currentTimeMillis()); long timeout = DEFAULT_TIMEOUT - (System.currentTimeMillis() - requestTime); int layoutId; if (isForPlugin) { layoutId = R.layout.confirm_auth_activity_plugin; } else { layoutId = R.layout.confirm_auth_activity_manager; } View view = inflater.inflate(layoutId, container, false); view.setFocusableInTouchMode(true); view.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(final View v, final int keyCode, final KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) { notApprovalProc(); return true; } return false; } }); // ? TextView textViewExpirePeriod = (TextView) view.findViewById(R.id.textViewExpirePeriod); textViewExpirePeriod.setText(expirePeriod); // ?? TextView textViewApplicationName = (TextView) view.findViewById(R.id.textViewAccessToken); textViewApplicationName.setText(applicationName); // ListView listViewScopes = (ListView) view.findViewById(R.id.listViewScopes); listViewScopes.setAdapter(new ArrayAdapter<>(getActivity(), R.layout.confirm_auth_scopes_list_item, R.id.textViewScope, displayScopes)); // ? Button buttonApproval = (Button) view.findViewById(R.id.buttonApproval); buttonApproval.setOnClickListener(mOnButtonApprovalClickListener); // ? Button buttonReject = (Button) view.findViewById(R.id.buttonReject); buttonReject.setOnClickListener(mOnButtonApprovalClickListener); if (!isForPlugin) { // ?(=?)??? TextView textViewPackageName = (TextView) view.findViewById(R.id.textPackageName); textViewPackageName.setText(packageName); // TextView textViewKeyword = (TextView) view.findViewById(R.id.textKeyword); textViewKeyword.setText(keyword); } if (timeout > 0) { startTimeoutTimer(timeout); } else { // ????????Activity? getActivity().finish(); } if (isAutoFlag) { new Handler(Looper.getMainLooper()).post(new Runnable() { @Override public void run() { approvalProc(); } }); } return view; }
From source file:net.micode.fileexplorer.FileViewActivity.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mActivity = getActivity();/* w w w . j a v a 2 s . c o m*/ // getWindow().setFormat(android.graphics.PixelFormat.RGBA_8888); mRootView = inflater.inflate(R.layout.file_explorer_list, container, false); ActivitiesManager.getInstance().registerActivity(ActivitiesManager.ACTIVITY_FILE_VIEW, mActivity); mFileCagetoryHelper = new FileCategoryHelper(mActivity); mFileViewInteractionHub = new FileViewInteractionHub(this); Intent intent = mActivity.getIntent(); String action = intent.getAction(); if (!TextUtils.isEmpty(action) && (action.equals(Intent.ACTION_PICK) || action.equals(Intent.ACTION_GET_CONTENT))) { mFileViewInteractionHub.setMode(Mode.Pick); boolean pickFolder = intent.getBooleanExtra(PICK_FOLDER, false); if (!pickFolder) { String[] exts = intent.getStringArrayExtra(EXT_FILTER_KEY); if (exts != null) { mFileCagetoryHelper.setCustomCategory(exts); } } else { mFileCagetoryHelper.setCustomCategory(new String[] {} /*folder only*/); mRootView.findViewById(R.id.pick_operation_bar).setVisibility(View.VISIBLE); mRootView.findViewById(R.id.button_pick_confirm).setOnClickListener(new OnClickListener() { public void onClick(View v) { try { Intent intent = Intent.parseUri(mFileViewInteractionHub.getCurrentPath(), 0); mActivity.setResult(Activity.RESULT_OK, intent); mActivity.finish(); } catch (URISyntaxException e) { e.printStackTrace(); } } }); mRootView.findViewById(R.id.button_pick_cancel).setOnClickListener(new OnClickListener() { public void onClick(View v) { mActivity.finish(); } }); } } else { mFileViewInteractionHub.setMode(Mode.View); } mFileListView = (ListView) mRootView.findViewById(R.id.file_path_list); mFileIconHelper = new FileIconHelper(mActivity); mAdapter = new FileListAdapter(mActivity, R.layout.file_browser_item, mFileNameList, mFileViewInteractionHub, mFileIconHelper); boolean baseSd = intent.getBooleanExtra(GlobalConsts.KEY_BASE_SD, !FileExplorerPreferenceActivity.isReadRoot(mActivity)); Log.i(LOG_TAG, "baseSd = " + baseSd); String rootDir = intent.getStringExtra(ROOT_DIRECTORY); if (!TextUtils.isEmpty(rootDir)) { if (baseSd && this.sdDir.startsWith(rootDir)) { rootDir = this.sdDir; } } else { rootDir = baseSd ? this.sdDir : GlobalConsts.ROOT_PATH; } mFileViewInteractionHub.setRootPath(rootDir); String currentDir = FileExplorerPreferenceActivity.getPrimaryFolder(mActivity); Uri uri = intent.getData(); if (uri != null) { if (baseSd && this.sdDir.startsWith(uri.getPath())) { currentDir = this.sdDir; } else { currentDir = uri.getPath(); } } mFileViewInteractionHub.setCurrentPath(currentDir); Log.i(LOG_TAG, "CurrentDir = " + currentDir); mBackspaceExit = (uri != null) && (TextUtils.isEmpty(action) || (!action.equals(Intent.ACTION_PICK) && !action.equals(Intent.ACTION_GET_CONTENT))); mFileListView.setAdapter(mAdapter); mFileViewInteractionHub.refreshFileList(); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Intent.ACTION_MEDIA_MOUNTED); intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED); intentFilter.addDataScheme("file"); mActivity.registerReceiver(mReceiver, intentFilter); updateUI(); setHasOptionsMenu(true); return mRootView; }
From source file:jp.co.conit.sss.sp.ex1.billing.BillingService.java
/** * The {@link BillingReceiver} sends messages to this service using intents. * Each intent has an action and some extra arguments specific to that * action./*from w ww . j av a2s . c o m*/ * * @param intent the intent containing one of the supported actions * @param startId an identifier for the invocation instance of this service */ public void handleCommand(Intent intent, int startId) { if (intent == null) { return; } String action = intent.getAction(); if (Consts.ACTION_CONFIRM_NOTIFICATION.equals(action)) { String[] notifyIds = intent.getStringArrayExtra(Consts.NOTIFICATION_ID); confirmNotifications(startId, notifyIds); } else if (Consts.ACTION_GET_PURCHASE_INFORMATION.equals(action)) { String notifyId = intent.getStringExtra(Consts.NOTIFICATION_ID); getPurchaseInformation(startId, new String[] { notifyId }); } else if (Consts.ACTION_PURCHASE_STATE_CHANGED.equals(action)) { String signedData = intent.getStringExtra(Consts.INAPP_SIGNED_DATA); String signature = intent.getStringExtra(Consts.INAPP_SIGNATURE); purchaseStateChanged(startId, signedData, signature); } else if (Consts.ACTION_RESPONSE_CODE.equals(action)) { long requestId = intent.getLongExtra(Consts.INAPP_REQUEST_ID, -1); int responseCodeIndex = intent.getIntExtra(Consts.INAPP_RESPONSE_CODE, ResponseCode.RESULT_ERROR.ordinal()); ResponseCode responseCode = ResponseCode.valueOf(responseCodeIndex); checkResponseCode(requestId, responseCode); } }
From source file:com.callba.phone.ui.NewGroupActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); String st1 = getResources().getString(R.string.Is_to_create_a_group_chat); final String st2 = getResources().getString(R.string.Failed_to_create_groups); if (resultCode == RESULT_OK) { ///*from ww w . j a v a2 s. c o m*/ progressDialog = new ProgressDialog(this); progressDialog.setMessage(st1); progressDialog.setCanceledOnTouchOutside(false); progressDialog.show(); new Thread(new Runnable() { @Override public void run() { // sdk final String groupName = groupNameEditText.getText().toString().trim(); String desc = introductionEditText.getText().toString(); String[] members = data.getStringArrayExtra("newmembers"); try { EMGroupOptions option = new EMGroupOptions(); option.maxUsers = 200; String reason = NewGroupActivity.this.getString(R.string.invite_join_group); reason = EMClient.getInstance().getCurrentUser() + reason + groupName; if (publibCheckBox.isChecked()) { option.style = memberCheckbox.isChecked() ? EMGroupStyle.EMGroupStylePublicJoinNeedApproval : EMGroupStyle.EMGroupStylePublicOpenJoin; } else { option.style = memberCheckbox.isChecked() ? EMGroupStyle.EMGroupStylePrivateMemberCanInvite : EMGroupStyle.EMGroupStylePrivateOnlyOwnerInvite; } EMClient.getInstance().groupManager().createGroup(groupName, desc, members, reason, option); runOnUiThread(new Runnable() { public void run() { LocalBroadcastManager.getInstance(NewGroupActivity.this) .sendBroadcast(new Intent(Constant.ACTION_GROUP_CHANAGED)); progressDialog.dismiss(); finish(); } }); } catch (final HyphenateException e) { runOnUiThread(new Runnable() { public void run() { progressDialog.dismiss(); Toast.makeText(NewGroupActivity.this, st2 + e.getLocalizedMessage(), Toast.LENGTH_SHORT).show(); } }); } } }).start(); } }
From source file:com.easemob.chatuidemo.activity.NewGroupActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); String st1 = getResources().getString(R.string.Is_to_create_a_group_chat); final String st2 = getResources().getString(R.string.Failed_to_create_groups); if (resultCode == RESULT_OK) { ///*from w w w. j av a 2 s. c o m*/ /* progressDialog = new ProgressDialog(this); progressDialog.setMessage(st1); progressDialog.setCanceledOnTouchOutside(false); progressDialog.show();*/ /* new Thread(new Runnable() { @Override public void run() {*/ // sdk String groupName = groupNameEditText.getText().toString().trim(); String desc = introductionEditText.getText().toString(); String[] members = data.getStringArrayExtra("newmembers"); StringBuffer sb = new StringBuffer(); ; for (int i = 0; i < members.length; i++) { String sb_child; if (i != members.length - 1) { sb_child = members[i] + ","; } else { sb_child = members[i]; } sb.append(sb_child); } try { if (checkBox.isChecked()) { setGroup(groupName, desc, "1", sb.toString(), "0"); // progressDialog.dismiss(); //??? //??????? // EMGroupManager.getInstance().createPublicGroup(groupName, desc, members, true, 200); } else { if (memberCheckbox.isChecked()) { setGroup(groupName, desc, "0", sb.toString(), "1"); } else { setGroup(groupName, desc, "0", sb.toString(), "0"); } //?o //EMGroupManager.getInstance().createPrivateGroup(groupName, desc, members, memberCheckbox.isChecked(), 200); } /* runOnUiThread(new Runnable() { public void run() { progressDialog.dismiss(); setResult(RESULT_OK); finish(); } });*/ } catch (final Exception e) { runOnUiThread(new Runnable() { public void run() { //progressDialog.dismiss(); Toast.makeText(NewGroupActivity.this, st2 + e.getLocalizedMessage(), 1).show(); } }); } /* } }).start();*/ } }
From source file:com.ultramegasoft.flavordex2.fragment.EntrySearchFragment.java
/** * Parse the form fields and send the results to the Activity. *//*from w w w .j a v a 2s . c o m*/ private void performFilter() { final Fragment fragment = getChildFragmentManager().findFragmentById(R.id.search_form); if (fragment instanceof SearchFormFragment) { final Intent intent = ((SearchFormFragment) fragment).getData(); if (getActivity() instanceof EntrySearchActivity) { ((EntrySearchActivity) getActivity()).publishResult(intent); } else if (getActivity() instanceof EntryListActivity) { final ContentValues filters = intent.getParcelableExtra(EXTRA_FILTERS); final String where = intent.getStringExtra(EXTRA_WHERE); final String[] whereArgs = intent.getStringArrayExtra(EXTRA_WHERE_ARGS); ((EntryListActivity) getActivity()).onSearchSubmitted(filters, where, whereArgs); } } }
From source file:com.android.ex.photo.PhotoViewActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final ActivityManager mgr = (ActivityManager) getApplicationContext() .getSystemService(Activity.ACTIVITY_SERVICE); sMemoryClass = mgr.getMemoryClass(); Intent mIntent = getIntent(); int currentItem = -1; if (savedInstanceState != null) { currentItem = savedInstanceState.getInt(STATE_ITEM_KEY, -1); mFullScreen = savedInstanceState.getBoolean(STATE_FULLSCREEN_KEY, false); }/*from ww w . jav a 2 s . co m*/ // uri of the photos to view; optional if (mIntent.hasExtra(Intents.EXTRA_PHOTOS_URI)) { mPhotosUri = mIntent.getStringExtra(Intents.EXTRA_PHOTOS_URI); } // projection for the query; optional // I.f not set, the default projection is used. // This projection must include the columns from the default projection. if (mIntent.hasExtra(Intents.EXTRA_PROJECTION)) { mProjection = mIntent.getStringArrayExtra(Intents.EXTRA_PROJECTION); } else { mProjection = null; } // Set the current item from the intent if wasn't in the saved instance if (mIntent.hasExtra(Intents.EXTRA_PHOTO_INDEX) && currentItem < 0) { currentItem = mIntent.getIntExtra(Intents.EXTRA_PHOTO_INDEX, -1); } mPhotoIndex = currentItem; setContentView(R.layout.photo_activity_view); // Create the adapter and add the view pager mAdapter = new PhotoPagerAdapter(this, getFragmentManager(), null); mViewPager = (PhotoViewPager) findViewById(R.id.photo_view_pager); mViewPager.setAdapter(mAdapter); mViewPager.setOnPageChangeListener(this); mViewPager.setOnInterceptTouchListener(this); // Kick off the loader getLoaderManager().initLoader(LOADER_PHOTO_LIST, null, this); final ActionBar actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); mActionBarHideDelayTime = getResources().getInteger(R.integer.action_bar_delay_time_in_millis); actionBar.addOnMenuVisibilityListener(this); actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE); }