List of usage examples for android.os Bundle getStringArrayList
@Override
@Nullable
public ArrayList<String> getStringArrayList(@Nullable String key)
From source file:li.klass.fhem.fragments.SendCommandFragment.java
@Override public void update(boolean doUpdate) { Intent intent = new Intent(Actions.RECENT_COMMAND_LIST); intent.setClass(getActivity(), SendCommandIntentService.class); intent.putExtra(BundleExtraKeys.RESULT_RECEIVER, new ResultReceiver(new Handler()) { @Override/*from w w w . ja v a 2s.co m*/ protected void onReceiveResult(int resultCode, Bundle resultData) { if (resultCode != ResultCodes.SUCCESS || resultData == null || !resultData.containsKey(BundleExtraKeys.RECENT_COMMANDS)) { return; } View view = getView(); if (view == null) return; recentCommands = resultData.getStringArrayList(BundleExtraKeys.RECENT_COMMANDS); recentCommandsAdapter.clear(); // careful: addAll method is only available since API level 11 (Android 3.0) for (String recentCommand : recentCommands) { recentCommandsAdapter.add(recentCommand); } recentCommandsAdapter.notifyDataSetChanged(); ListViewUtil.setHeightBasedOnChildren((ListView) view.findViewById(R.id.command_history)); getActivity().sendBroadcast(new Intent(Actions.DISMISS_EXECUTING_DIALOG)); } }); getActivity().startService(intent); }
From source file:com.tangrainc.inappbilling.InAppBillingHelper.java
public ListenableFuture<JSONObject[]> getProducts() { return _executor.submit(new Callable<JSONObject[]>() { @Override/* ww w. j a v a2 s .c o m*/ public JSONObject[] call() throws Exception { // Wait for the service to be initialized (if call too soon after constructor) int loop = 0; while (_service == null || loop < 20) { Thread.sleep(500); loop++; } if (_service == null) { throw new Exception( "Billing service could not be connected for 10 secs! May be running on an emulator w/o Google Service?"); } Bundle queryProducts = new Bundle(); queryProducts.putStringArrayList("ITEM_ID_LIST", new ArrayList<>(Arrays.asList(_productIdentifiers))); Bundle productDetails = _service.getSkuDetails(3, _context.getPackageName(), "inapp", queryProducts); ArrayList<JSONObject> result = new ArrayList<>(); int response = productDetails.getInt("RESPONSE_CODE"); if (response == 0) { ArrayList<String> responseList = productDetails.getStringArrayList("DETAILS_LIST"); for (String thisResponse : responseList) { result.add(new JSONObject(thisResponse)); } return result.toArray(new JSONObject[0]); } else { throw new Exception("Response from service: " + response); } } }); }
From source file:net.olejon.mdapp.DonateActivity.java
private void resetDonations() { try {//from w ww. j a v a 2s . co m Bundle bundle = mIInAppBillingService.getPurchases(3, getPackageName(), "inapp", null); int responseCode = bundle.getInt("RESPONSE_CODE"); if (responseCode == 0) { ArrayList<String> purchaseDataArrayList = bundle.getStringArrayList("INAPP_PURCHASE_DATA_LIST"); for (String purchaseData : purchaseDataArrayList) { JSONObject purchaseDataJsonObject = new JSONObject(purchaseData); consumeDonation(purchaseDataJsonObject.getString("purchaseToken")); } mTools.showToast(getString(R.string.donate_reset_successful), 0); } else { new MaterialDialog.Builder(mContext).title(getString(R.string.device_not_supported_dialog_title)) .content(getString(R.string.device_not_supported_dialog_message)) .positiveText(getString(R.string.device_not_supported_dialog_positive_button)) .contentColorRes(R.color.black).positiveColorRes(R.color.dark_blue).show(); } } catch (Exception e) { new MaterialDialog.Builder(mContext).title(getString(R.string.device_not_supported_dialog_title)) .content(getString(R.string.device_not_supported_dialog_message)) .positiveText(getString(R.string.device_not_supported_dialog_positive_button)) .contentColorRes(R.color.black).positiveColorRes(R.color.dark_blue).show(); } }
From source file:com.pixplicity.castdemo.MainActivity.java
@Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); mLvMessages.setAdapter(null);/* w ww. j a v a 2 s. c om*/ mMessageListUsernames = savedInstanceState.getStringArrayList("usernames"); mMessageListMessages = savedInstanceState.getStringArrayList("messages"); updateMessages(); }
From source file:rosmi.acagild.alarmclock.settings.AlarmSettingsFragment.java
@Override public void onCreatePreferences(Bundle bundle, final String s) { addPreferencesFromResource(R.xml.pref_alarm); Bundle args = getArguments(); UUID alarmId = UUID.fromString(args.getString(ARGS_ALARM_ID)); mAlarm = AlarmList.get(getContext()).getAlarm(alarmId); ArrayList<String> enabledMimics = args.getStringArrayList(ARGS_ENABLED_MIMICS); // Initialize the preferences from the alarm object before populating the settings list initializeTimePreference();//from ww w. ja v a 2s. c o m initializeRepeatingDaysPreference(); initializeNamePreference(); initializeRingtonePreference(); initializeVibratePreference(); initializeButtons(); }
From source file:it.geosolutions.android.map.fragment.FeatureInfoAttributeListFragment.java
/** * Called only once/*from w w w . j a v a 2s. c o m*/ */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // view operations setRetainInstance(true); // start progress bars getSherlockActivity().setSupportProgressBarIndeterminateVisibility(true); getSherlockActivity().setSupportProgressBarVisibility(true); // get data from the intent // TODO get them from arguments Bundle extras = getActivity().getIntent().getExtras(); ; // TODO get already loaded data; query = (FeatureInfoQuery) extras.getParcelable("query"); layers = extras.getStringArrayList("layers"); start = extras.getInt("start"); limit = extras.getInt("limit"); // setup the listView adapter = new FeatureInfoAttributesAdapter(getSherlockActivity(), R.layout.feature_info_attribute_row); setListAdapter(adapter); startDataLoading(query, layers, start, 2);// use 2 to check availability of // the next page }
From source file:tv.acfun.a63.ImagePagerActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY); super.onCreate(savedInstanceState); ActionBarUtil.setXiaomiFilterDisplayOptions(getSupportActionBar(), false); getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.ab_bg_trans)); Bundle extras = getIntent().getExtras(); title = extras.getString("title"); getSupportActionBar().setTitle(title); aid = extras.getInt("aid"); mList = extras.getStringArrayList(EXTRA_IMAGES); int index = extras.getInt(EXTRA_INDEX, 0); MobclickAgent.onEvent(this, "view_big_pic", "ac" + aid + "/" + index); setContentView(R.layout.activity_images); indexText = (TextView) findViewById(R.id.index); pager = (ViewPager) findViewById(R.id.pager); pager.setAdapter(new ImageAdapter(getSupportFragmentManager(), mList)); pager.setOnPageChangeListener(this); pager.setCurrentItem(index);// www .ja va 2 s .c o m onPageSelected(index); }
From source file:com.kaliturin.blacklist.fragments.AddOrEditContactFragment.java
private void addRowsToNumbersList(Bundle data) { if (data == null) { return;/*from ww w .ja v a 2 s .c o m*/ } // get numbers and types from parameters ArrayList<String> numbers = data.getStringArrayList(CONTACT_NUMBERS); ArrayList<Integer> types = data.getIntegerArrayList(CONTACT_NUMBER_TYPES); if (numbers != null && types != null && numbers.size() == types.size()) { // get the set of unique pairs of numbers/types form the current view Set<Pair<String, Integer>> numbers2TypeSet = getNumber2TypePairs(); for (int i = 0; i < numbers.size(); i++) { String number = numbers.get(i); int type = types.get(i); // add to View only rows with unique pair of number/type if (numbers2TypeSet.add(new Pair<>(number, type))) { addRowToNumbersList(number, type); } } } }
From source file:com.flat20.fingerplay.FingerPlayActivity.java
private void checkPurchases() { try {//from www . j a v a 2s . c o m Bundle ownedItems = mBillingService.getPurchases(3, getPackageName(), "subs", null); if (ownedItems.getInt("RESPONSE_CODE") == 0) { ArrayList<String> ownedSkus = ownedItems.getStringArrayList("INAPP_PURCHASE_ITEM_LIST"); ArrayList<String> ownedData = ownedItems.getStringArrayList("INAPP_PURCHASE_DATA_LIST"); if (ownedSkus == null || ownedSkus.isEmpty()) { showSubscribeDialog(); } else { for (int i = 0; i < ownedSkus.size(); i++) { if (IAP_SUBS_KEY.equals(ownedSkus.get(i))) { JSONObject jsonData = new JSONObject(ownedData.get(i)); int purchaseState = jsonData.getInt("purchaseState"); if (purchaseState == 0) { Toast.makeText(this, R.string.toast_subs_verified, Toast.LENGTH_SHORT).show(); if (TextUtils.isEmpty(PreferenceManager.getDefaultSharedPreferences(this) .getString("settings_server_address", null))) { Toast.makeText(this, R.string.toast_server_not_setup, Toast.LENGTH_SHORT) .show(); startActivity(new Intent(getApplicationContext(), SettingsView.class)); } } else if (purchaseState == 1) { unableToVerifyLicense(getString(R.string.billing_error_cancelled), true); } else if (purchaseState == 2) { unableToVerifyLicense(getString(R.string.billing_error_refunded), true); } else { unableToVerifyLicense(getString(R.string.billing_error_unknown_state), true); } } } } } else { unableToVerifyLicense(getString(R.string.billing_error_unknown), true); } } catch (Exception e) { Log.e("Fingerplay", "Error checking for purchases", e); unableToVerifyLicense(getString(R.string.billing_error_unknown), true); } }
From source file:com.microsoft.mimickeralarm.settings.AlarmSettingsFragment.java
@Override public void onCreatePreferences(Bundle bundle, final String s) { addPreferencesFromResource(R.xml.pref_alarm); Bundle args = getArguments(); UUID alarmId = UUID.fromString(args.getString(ARGS_ALARM_ID)); mAlarm = AlarmList.get(getContext()).getAlarm(alarmId); ArrayList<String> enabledMimics = args.getStringArrayList(ARGS_ENABLED_MIMICS); // Initialize the preferences from the alarm object before populating the settings list initializeTimePreference();/*from w w w . j a v a 2 s . com*/ initializeRepeatingDaysPreference(); initializeNamePreference(); initializeMimicsPreference(enabledMimics); initializeRingtonePreference(); initializeVibratePreference(); initializeButtons(); }