Java Code Examples for android.content.Intent#getSerializableExtra()
The following examples show how to use
android.content.Intent#getSerializableExtra() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MainActivity.java From buffer_bci with GNU General Public License v3.0 | 7 votes |
private void updateThreadsInfo(Intent intent) { ThreadInfo threadInfo=null; if ( intent.hasExtra(C.THREAD_INFO)) { try { threadInfo = intent.getParcelableExtra(C.THREAD_INFO); } catch ( Exception ex) { Log.d(TAG, "Couldn't unparcel the thread info......"); return; } } int nArgs = intent.getIntExtra(C.THREAD_N_ARGUMENTS, 0); Argument[] arguments = new Argument[nArgs]; for (int i = 0; i < nArgs; i++) { arguments[i] = (Argument) intent.getSerializableExtra(C.THREAD_ARGUMENTS + i); } clientsController.updateThreadInfoAndArguments(threadInfo, arguments); this.updateClientsGui(); }
Example 2
Source File: MyRoutesTab.java From kute with Apache License 2.0 | 6 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(resultCode==add_route_activity_code){ //get the newly added route from data intent and add it to the recycler Route r=(Route)data.getSerializableExtra("Route"); if (r!=null){ Log.i(TAG,"onActivityResult : Received Route from add route"); my_routes_list.add(r); recycler_adapter.notifyItemInserted(recycler_adapter.getItemCount()+1); } }else if(requestCode==ROUTE_DETAIL_CODE){ if (resultCode==ROUTE_DELETE_CODE){ my_routes_list.remove(current_clicked_object-1); recycler_adapter.notifyItemRemoved(current_clicked_object); } } }
Example 3
Source File: FinalCityInfoActivity.java From Travel-Mate with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_city_info); ButterKnife.bind(this); mFinalCityInfoPresenter = new FinalCityInfoPresenter(); mHandler = new Handler(Looper.getMainLooper()); mDatabase = AppDataBase.getAppDatabase(this); Intent intent = getIntent(); mCity = (City) intent.getSerializableExtra(EXTRA_MESSAGE_CITY_OBJECT); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); mToken = sharedPreferences.getString(USER_TOKEN, null); initUi(); initPresenter(); }
Example 4
Source File: RestaurantsActivity.java From Travel-Mate with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_restaurants); ButterKnife.bind(this); Intent intent = getIntent(); mCity = (City) intent.getSerializableExtra(EXTRA_MESSAGE_CITY_OBJECT); mHandler = new Handler(Looper.getMainLooper()); mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); mToken = mSharedPreferences.getString(USER_TOKEN, null); Objects.requireNonNull(getSupportActionBar()).setDisplayHomeAsUpEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); setTitle(mCity.getNickname()); mRestaurantsCardViewAdapter = new RestaurantsCardViewAdapter(this, restaurantItemEntities); RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(RestaurantsActivity.this); mRestaurantsOptionsRecycleView.setLayoutManager(mLayoutManager); mRestaurantsOptionsRecycleView.setItemAnimator(new DefaultItemAnimator()); mRestaurantsOptionsRecycleView.setAdapter(mRestaurantsCardViewAdapter); }
Example 5
Source File: ColumnActivity.java From BaoKanAndroid with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_column); // 取出栏目数据 Intent intent = getIntent(); selectedList = (List<ColumnBean>) intent.getSerializableExtra("selectedList_key"); optionalList = (List<ColumnBean>) intent.getSerializableExtra("optionalList_key"); mNavigationViewRed = (NavigationViewRed) findViewById(R.id.nav_column); mNavigationViewRed.getRightView().setImageResource(R.drawable.top_navigation_close); mNavigationViewRed.setupNavigationView(false, true, "栏目管理", new NavigationViewRed.OnClickListener() { @Override public void onRightClick(View v) { setupResultData(); finish(); } }); // 准备UI prepareUI(); }
Example 6
Source File: Texting.java From appinventor-extensions with Apache License 2.0 | 6 votes |
/** * Parse the messages out of the extra fields from the "android.permission.RECEIVE_SMS" broadcast * intent. * * Note: This code was copied from the Android android.provider.Telephony.Sms.Intents class. * * @param intent the intent to read from * @return an array of SmsMessages for the PDUs */ public static SmsMessage[] getMessagesFromIntent( Intent intent) { Object[] messages = (Object[]) intent.getSerializableExtra("pdus"); byte[][] pduObjs = new byte[messages.length][]; for (int i = 0; i < messages.length; i++) { pduObjs[i] = (byte[]) messages[i]; } byte[][] pdus = new byte[pduObjs.length][]; int pduCount = pdus.length; SmsMessage[] msgs = new SmsMessage[pduCount]; for (int i = 0; i < pduCount; i++) { pdus[i] = pduObjs[i]; msgs[i] = SmsMessage.createFromPdu(pdus[i]); } return msgs; }
Example 7
Source File: SettingAddressActivity.java From Mobike with Apache License 2.0 | 5 votes |
private void updataAddress1(Intent data) { PoiObject poiObject= (PoiObject) data.getSerializableExtra("PoiObject"); mStar1.setImageResource(R.drawable.address_star_selected); mAddress1.setText(poiObject.address); mDistrict1.setText(poiObject.district); PreferencesUtils.putString(SettingAddressActivity.this,FIRST_ADDRESS,JSONUtil.toJSON(poiObject)); }
Example 8
Source File: ExpirationListener.java From bcm-android with GNU General Public License v3.0 | 5 votes |
@Override public void onReceive(Context context, Intent intent) { try { if (intent.hasExtra(ARouterConstants.PARAM.PARAM_ACCOUNT_CONTEXT)) { Serializable obj = intent.getSerializableExtra(ARouterConstants.PARAM.PARAM_ACCOUNT_CONTEXT); if (obj instanceof AccountContext) { ExpirationManager.INSTANCE.get((AccountContext)obj).checkSchedule(); } } } catch (Throwable e) { ALog.e("ExpirationListener", e); } }
Example 9
Source File: MenuFragment.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); ZogUtils.printError(MenuFragment.class, "resultCode::::::" + resultCode); switch (resultCode) { case ResultCode.RESULT_CODE_EXIT: { clearProfile(); } break; case ResultCode.RESULT_CODE_LOGIN: { if (data != null && data.getBooleanExtra(Key.KEY_LOGINED, false)) { ProfileJson json = (ProfileJson) data.getSerializableExtra(Key.KEY_LOGIN_RESULT); if (json == null) { updateProfile(); } else { updateUi(json); } } } break; case Activity.RESULT_OK: if (requestCode == ImageLibRequestResultCode.REQUEST_SELECT_PIC) { AvatalUtils.uploadAvatal(getActivity(), data, mPhotoImage, new DoSomeThing() { @Override public void execute(Object... object) { if (getActivity() instanceof QQStyleMainActivity) { ((QQStyleMainActivity) getActivity()).refreshAvatar(); } } }); } break; } }
Example 10
Source File: ReactInterfaceManager.java From native-navigation with MIT License | 5 votes |
private static Map<String, Object> getPayloadFromIntent(Intent data) { if (data != null && data.hasExtra(EXTRA_PAYLOAD)) { //noinspection unchecked return (Map<String, Object>) data.getSerializableExtra(EXTRA_PAYLOAD); } else { return Collections.emptyMap(); } }
Example 11
Source File: WeChatStyleMainActivity.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
private boolean getData() { Intent intent = getIntent(); if (intent == null) { return false; } mProfileVariables = (ProfileVariables) intent.getSerializableExtra(Key.KEY_PROFILE); if (mProfileVariables == null) { return false; } return true; }
Example 12
Source File: MainActivity.java From letv with Apache License 2.0 | 5 votes |
private void parseIntentData(Intent intent) { if (intent != null) { this.mIsFromPush = isFromPush(intent); this.mIsForceLaunch = intent.getBooleanExtra("forceLaunch", false); this.mFromMobileSite = intent.getBooleanExtra("from_M", false); this.mChannelPageData = (Channel) intent.getSerializableExtra("channel"); this.mShouldJumpToDownloadPage = intent.getBooleanExtra(MyDownloadActivityConfig.TO_DOWNLOAD, false); jumpFromPush(intent, intent.getIntExtra("LaunchMode", 0)); } }
Example 13
Source File: LoginActivity.java From UpdogFarmer with GNU General Public License v3.0 | 5 votes |
@Override public void onReceive(Context context, Intent intent) { if (SteamService.LOGIN_EVENT.equals(intent.getAction())) { stopTimeout(); progress.setVisibility(View.GONE); final EResult result = (EResult) intent.getSerializableExtra(SteamService.RESULT); if (result != EResult.OK) { loginButton.setEnabled(true); usernameInput.setErrorEnabled(false); passwordInput.setErrorEnabled(false); twoFactorInput.setErrorEnabled(false); if (result == EResult.InvalidPassword) { passwordInput.setError(getString(R.string.invalid_password)); } else if (result == EResult.AccountLoginDeniedNeedTwoFactor || result == EResult.AccountLogonDenied || result == EResult.AccountLogonDeniedNoMail || result == EResult.AccountLogonDeniedVerifiedEmailRequired) { twoFactorRequired = result == EResult.AccountLoginDeniedNeedTwoFactor; if (twoFactorRequired && timeDifference != null) { // Fill in the SteamGuard code twoFactorEditText.setText(SteamGuard.generateSteamGuardCodeForTime(Utils.getCurrentUnixTime() + timeDifference)); } twoFactorInput.setVisibility(View.VISIBLE); twoFactorInput.setError(getString(R.string.steamguard_required)); twoFactorEditText.requestFocus(); } else if (result == EResult.TwoFactorCodeMismatch || result == EResult.InvalidLoginAuthCode) { twoFactorInput.setError(getString(R.string.invalid_code)); } } else { // Save username final String username = Utils.removeSpecialChars(usernameEditText.getText().toString()).trim(); final String password = Utils.removeSpecialChars(passwordEditText.getText().toString().trim()); PrefsManager.writeUsername(username); PrefsManager.writePassword(LoginActivity.this, password); finish(); } } }
Example 14
Source File: CaptureActivity.java From imsdk-android with MIT License | 5 votes |
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { ArrayList<String> path = null; if(requestCode == ACTIVITY_SELECT_PHOTO){ //新版图片选择器 ArrayList<ImageItem> images = (ArrayList<ImageItem>) data.getSerializableExtra(ImagePicker.EXTRA_RESULT_ITEMS); if (images.size() > 0) { if(path == null){ path = new ArrayList<>(); } for (ImageItem image : images) { path.add(image.path); } } }else if(requestCode == CODE_GALLERY_REQUEST){ path = data.getStringArrayListExtra(PictureSelectorActivity.KEY_SELECTED_PIC); } if(path!=null&&path.size()>0) { Result result = DecodeBitmap.scanningImage(path.get(0)); // String result = QRUtil.cognitiveQR(bitmap); if (result == null) { }else{ beepManager.playBeepSoundAndVibrate(); String scanResult = DecodeBitmap.parseReuslt(result.toString()); Intent intent = getIntent(); intent.putExtra("content", scanResult); setResult(Activity.RESULT_OK, intent); finish(); } } } }
Example 15
Source File: Session.java From KlyphMessenger with MIT License | 4 votes |
/** * Provides an implementation for {@link Activity#onActivityResult * onActivityResult} that updates the Session based on information returned * during the authorization flow. The Activity that calls open or * requestNewPermissions should forward the resulting onActivityResult call here to * update the Session state based on the contents of the resultCode and * data. * * @param currentActivity The Activity that is forwarding the onActivityResult call. * @param requestCode The requestCode parameter from the forwarded call. When this * onActivityResult occurs as part of Facebook authorization * flow, this value is the activityCode passed to open or * authorize. * @param resultCode An int containing the resultCode parameter from the forwarded * call. * @param data The Intent passed as the data parameter from the forwarded * call. * @return A boolean indicating whether the requestCode matched a pending * authorization request for this Session. */ public final boolean onActivityResult(Activity currentActivity, int requestCode, int resultCode, Intent data) { Validate.notNull(currentActivity, "currentActivity"); initializeStaticContext(currentActivity); synchronized (lock) { if (pendingAuthorizationRequest == null || (requestCode != pendingAuthorizationRequest.getRequestCode())) { return false; } } Exception exception = null; AuthorizationClient.Result.Code code = AuthorizationClient.Result.Code.ERROR; if (data != null) { AuthorizationClient.Result result = (AuthorizationClient.Result) data.getSerializableExtra( LoginActivity.RESULT_KEY); if (result != null) { // This came from LoginActivity. handleAuthorizationResult(resultCode, result); return true; } else if (authorizationClient != null) { // Delegate to the auth client. authorizationClient.onActivityResult(requestCode, resultCode, data); return true; } } else if (resultCode == Activity.RESULT_CANCELED) { exception = new FacebookOperationCanceledException("User canceled operation."); code = AuthorizationClient.Result.Code.CANCEL; } if (exception == null) { exception = new FacebookException("Unexpected call to Session.onActivityResult"); } logAuthorizationComplete(code, null, exception); finishAuthOrReauth(null, exception); return true; }
Example 16
Source File: SoundService.java From volume_control_android with MIT License | 4 votes |
@Override public int onStartCommand(Intent intent, int flags, int startId) { String action = intent != null ? intent.getAction() : null; if (!DNDModeChecker.isDNDPermissionGranted(this) && !STOP_ACTION.equals(action)) { Toast.makeText(this, getString(R.string.dnd_permission_title), Toast.LENGTH_LONG).show(); return super.onStartCommand(intent, flags, startId); } if (APPLY_PROFILE_ACTION.equals(action)) { try { SoundProfile profile = soundProfileStorage.loadById(intent.getIntExtra(PROFILE_ID, -1)); ProfileApplier.applyProfile(control, profile); } catch (JSONException e) { e.printStackTrace(); } registerListeners(profilesToShow); startForeground(); return super.onStartCommand(intent, flags, startId); } else if (STOP_ACTION.equals(action)) { stopForeground(true); notificationManagerCompat.cancel( staticNotificationNumber ); stop(startId); isForeground = false; return super.onStartCommand(intent, flags, startId); } else if (CHANGE_VOLUME_ACTION.equals(action)) { int type = intent.getIntExtra(EXTRA_TYPE, 0); if (intent.hasExtra(EXTRA_VOLUME)) { int volume = intent.getIntExtra(EXTRA_VOLUME, 0); control.setVolumeLevel(type, volume); } else { float delta = intent.getFloatExtra(EXTRA_VOLUME_DELTA, 0); int currentVolume = control.getLevel(type); int nextVolume = (int) (delta > 0 ? Math.ceil(currentVolume + delta) : Math.floor(currentVolume + delta)); control.setVolumeLevel(type, nextVolume); } registerListeners(profilesToShow); startForeground(); return START_STICKY; } else if (FOREGROUND_ACTION.equals(action)) { createStaticNotificationChannel(); showProfiles = intent.getBooleanExtra(EXTRA_SHOW_PROFILES, true); profilesToShow = (List<Integer>) intent.getSerializableExtra(EXTRA_VOLUME_TYPES_IDS); registerListeners(profilesToShow); startForeground(); return START_NOT_STICKY; } else { return super.onStartCommand(intent, flags, startId); } }
Example 17
Source File: SplitBCCHDAccountSendActivity.java From bither-android with Apache License 2.0 | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); splitCoin = (SplitCoin) intent.getSerializableExtra(SplitCoinKey); }
Example 18
Source File: PlacesOnMapActivity.java From Travel-Mate with MIT License | 4 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_places_on_map); ButterKnife.bind(this); editTextSearch.addTextChangedListener(this); Intent intent = getIntent(); mCity = (City) intent.getSerializableExtra(EXTRA_MESSAGE_CITY_OBJECT); String type = intent.getStringExtra(EXTRA_MESSAGE_TYPE); mHandler = new Handler(Looper.getMainLooper()); SharedPreferences mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); mToken = mSharedPreferences.getString(USER_TOKEN, null); sheetBehavior = BottomSheetBehavior.from(layoutBottomSheet); mMap = findViewById(R.id.map); setTitle(mCity.getNickname()); mMarker = this.getDrawable(R.drawable.ic_radio_button_checked_orange_24dp); mDefaultMarker = this.getDrawable(R.drawable.marker_default); switch (type) { case "restaurant": mMode = "eat-drink"; mIcon = R.drawable.restaurant; break; case "hangout": mMode = "going-out,leisure-outdoor"; mIcon = R.drawable.hangout; break; case "monument": mMode = "sights-museums"; mIcon = R.drawable.monuments; break; default: mMode = "shopping"; mIcon = R.drawable.shopping_icon; break; } getPlaces(); initMap(); setTitle("Places"); Objects.requireNonNull(getSupportActionBar()).setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); }
Example 19
Source File: FragmentActApply.java From BigApp_Discuz_Android with Apache License 2.0 | 4 votes |
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK && data != null && data.getExtras() != null) { switch (requestCode) { case 21://select case 71://radio if (mCurrentJoinFiled == null) { return; } mCurrentJoinFiled.setDefaultValue(data.getStringExtra("selected")); if (mAdapter != null) { mAdapter.notifyDataSetChanged(); } break; case 51://list case 61://checkbox if (mCurrentJoinFiled == null) { return; } mCurrentJoinFiled.selected_multi = data.getStringArrayExtra("selected_multi"); if (mAdapter != null) { mAdapter.notifyDataSetChanged(); } break; case 81://file Intent intent = data; List<ImageBean> images = (List<ImageBean>) intent .getSerializableExtra("images"); if (images == null || images.size() < 1) { return; } ImageBean imageBean = images.get(0); if (TextUtils.isEmpty(imageBean.path)) { return; } Bitmap bitmap = null; DisplayImageOptions options = ImageLibUitls.getDisplayImageOptions( getResources().getDrawable(com.kit.imagelib.R.drawable.no_picture), getResources().getDrawable(com.kit.imagelib.R.drawable.no_picture)); try { ImageSize targetSize = new ImageSize(80, 80); // result Bitmap will be fit to this size bitmap = ImageLoader.getInstance().loadImageSync("file://" + imageBean.path, targetSize, options); } catch (Throwable e) { e.printStackTrace(); } if (bitmap != null) { mCurrentJoinFiled.setDefaultValue(imageBean.path); if (mAdapter != null) { mAdapter.notifyDataSetChanged(); } } break; } } }
Example 20
Source File: Crop.java From MyBlogDemo with Apache License 2.0 | 2 votes |
/** * Retrieve error that caused crop to fail * * @param result Result Intent * @return Throwable handled in CropImageActivity */ public static Throwable getError(Intent result) { return (Throwable) result.getSerializableExtra(Extra.ERROR); }