List of usage examples for android.content Intent getSerializableExtra
public Serializable getSerializableExtra(String name)
From source file:im.vector.fragments.RoomsFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (Activity.RESULT_OK == resultCode) { if (requestCode == DIRECTORY_SOURCE_ACTIVITY_REQUEST_CODE) { mSelectedRoomDirectory = (RoomDirectoryData) data .getSerializableExtra(RoomDirectoryPickerActivity.EXTRA_OUT_ROOM_DIRECTORY_DATA); mAdapter.setPublicRooms(new ArrayList<PublicRoom>()); initPublicRooms(true);/*from w w w.j a va2s . c o m*/ } } }
From source file:pl.bcichecki.rms.client.android.fragments.EventsListFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == REQUEST_CODE_NEW_EVENT && resultCode == RESULT_CODE_OK) { downloadData();/*from www . j a v a 2 s .co m*/ } if (requestCode == REQUEST_CODE_EDIT_EVENT && resultCode == RESULT_CODE_OK) { Event eventToRefresh = (Event) data.getSerializableExtra(EDIT_EVENT_EXTRA_RET); refreshEvent(eventToRefresh); } }
From source file:auribises.com.visitorbook.Activites.VisitorEntryActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_visitor_entry); ButterKnife.inject(this); preferences = getSharedPreferences(Util.PREFS_NAME, MODE_PRIVATE); editor = preferences.edit();//from w w w . ja v a2 s.c o m progressDialog = new ProgressDialog(this); progressDialog.setMessage("Please Wait.."); progressDialog.setCancelable(false); visitorentry = new Visitorentry(); adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item); adapter.add("--Select Branch--"); adapter.add("Applied Sciences"); adapter.add("Civil Engineering"); adapter.add("Electrical Engineering"); adapter.add("Mechanical Engineering"); adapter.add("Electroncis & Communication Engineering"); adapter.add("Computer Science & Engineering"); adapter.add("Information Technology"); adapter.add("Production Engineering"); adapter.add("Business Administration"); adapter.add("Computer Applications"); ; spBranch.setAdapter(adapter); spBranch.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { if (i != 0) { visitorentry.setBranch(adapter.getItem(i)); } } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); adapter1 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item); adapter1.add("--Select IDProof--"); adapter1.add("Aadhar Card"); adapter1.add("License"); adapter1.add("PAN Card"); adapter1.add("Voter Card"); spIDProof.setAdapter(adapter1); spIDProof.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { if (i != 0) { visitorentry.setIDProof(adapter1.getItem(i)); } } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); adapter2 = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item); adapter2.add("--Vehicle Type--"); adapter2.add("Car"); adapter2.add("Bike"); adapter2.add("Activa"); adapter2.add("Auto"); adapter2.add("Bus"); spVehicle.setAdapter(adapter2); spVehicle.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { if (i != 0) { visitorentry.setVehicle(adapter2.getItem(i)); } } @Override public void onNothingSelected(AdapterView<?> adapterView) { } }); rbMale.setOnCheckedChangeListener(this); rbFemale.setOnCheckedChangeListener(this); resolver = getContentResolver(); requestQueue = Volley.newRequestQueue(this); Intent rcv = getIntent(); updateMode = rcv.hasExtra("keyVisitorentry"); if (updateMode) { rcvVisitorentry = (Visitorentry) rcv.getSerializableExtra("keyVisitorentry"); eTxtName.setText(rcvVisitorentry.getName()); eTxtPhone.setText(rcvVisitorentry.getPhone()); eTxtEmail.setText(rcvVisitorentry.getEmail()); eTxtAddress.setText(rcvVisitorentry.getAddress()); eTxtPurpose.setText(rcvVisitorentry.getPurpose()); eTxtDate.setText(rcvVisitorentry.getDate()); eTxtTime.setText(rcvVisitorentry.getTime()); eTxtTeacher.setText(rcvVisitorentry.getTeacher()); eTxtIDProofNumber.setText(rcvVisitorentry.getIDProofnumber()); eTxtVehicleNumber.setText(rcvVisitorentry.getVehiclenumber()); if (rcvVisitorentry.getGender().equals("Male")) { rbMale.setChecked(true); } else { rbFemale.setChecked(true); } Log.i("TEST", adapter + " - " + rcvVisitorentry.getBranch() + " - " + rcvVisitorentry.getIDProof() + " - " + rcvVisitorentry.getVehicle()); int p = 0; for (int i = 0; i < adapter.getCount(); i++) { if (adapter.getItem(i).equals(rcvVisitorentry.getBranch())) { Log.i("TEST1", adapter.getItem(i) + " - " + rcvVisitorentry.getBranch()); p = i; break; } } spBranch.setSelection(p); int q = 0; for (int i = 0; i < adapter1.getCount(); i++) { if (adapter1.getItem(i).equals(rcvVisitorentry.getIDProof())) { Log.i("TEST2", adapter1.getItem(i) + " - " + rcvVisitorentry.getIDProof()); q = i; break; } } spIDProof.setSelection(q); int r = 0; for (int i = 0; i < adapter2.getCount(); i++) { if (adapter2.getItem(i).equals(rcvVisitorentry.getVehicle())) { Log.i("TEST3", adapter2.getItem(i) + " - " + rcvVisitorentry.getVehicle()); r = i; break; } } spVehicle.setSelection(r); btnSubmit.setText("Update"); } }
From source file:org.irmacard.androidmanagement.CredentialListActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Pass the list of CredentialPackages on to the ListFragement Intent intent = getIntent(); @SuppressWarnings("unchecked") ArrayList<CredentialPackage> credentials = (ArrayList<CredentialPackage>) intent .getSerializableExtra(WaitingForCardActivity.EXTRA_CREDENTIAL_PACKAGES); setCredentials(credentials);//from ww w .j a v a 2 s . com @SuppressWarnings("unchecked") ArrayList<LogEntry> logs = (ArrayList<LogEntry>) intent .getSerializableExtra(WaitingForCardActivity.EXTRA_LOG_ENTRIES); setLogs(logs); Tag tag = (Tag) intent.getParcelableExtra(WaitingForCardActivity.EXTRA_TAG); setTag(tag); cardPin = (String) intent.getSerializableExtra(WaitingForCardActivity.EXTRA_CARD_PIN); cardVersion = (CardVersion) intent.getSerializableExtra(WaitingForCardActivity.EXTRA_CARD_VERSION); setContentView(R.layout.activity_credential_list); if (findViewById(R.id.credential_detail_container) != null) { // The detail container view will be present only in the // large-screen layouts (res/values-large and // res/values-sw600dp). If this view is present, then the // activity should be in two-pane mode. mTwoPane = true; // In two-pane mode, list items should be given the // 'activated' state when touched. ((MenuFragment) getSupportFragmentManager().findFragmentById(R.id.credential_menu_fragment)) .setTwoPaneMode(true); InitFragment initFragment = new InitFragment(); getSupportFragmentManager().beginTransaction().replace(R.id.credential_detail_container, initFragment) .commit(); Log.i("blaat", "Simulating initial click!!"); ((MenuFragment) getSupportFragmentManager().findFragmentById(R.id.credential_menu_fragment)) .simulateListClick(0); // Do not show action bar in two-pane mode getActionBar().hide(); } // NFC stuff nfcA = NfcAdapter.getDefaultAdapter(getApplicationContext()); mPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); // Setup an intent filter for all TECH based dispatches IntentFilter tech = new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED); mFilters = new IntentFilter[] { tech }; // Setup a tech list for all IsoDep cards mTechLists = new String[][] { new String[] { IsoDep.class.getName() } }; }
From source file:com.juick.android.ThreadActivity.java
public void onThreadLoaded(JuickMessage message) { String title = "@" + message.User.UName; SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this); boolean showNumbers = sp.getBoolean("showNumbers", false); if (showNumbers) title += " - " + message.getDisplayMessageNo() + " - " + com.juickadvanced.Utils .toRelaviteDate(message.Timestamp.getTime(), XMPPIncomingMessagesActivity.isRussian()); //TextView oldTitle = (TextView)findViewById(R.id.old_title); setTitle(title);/*from ww w. j a v a 2s. c o m*/ //oldTitle.setText(title); DatabaseService.rememberVisited(message); final Intent i = getIntent(); final Serializable prefetched = i.getSerializableExtra("prefetched"); JuickMessage prefetchedReply = null; if (prefetched != null && !focusedOnceOnPrefetched) { focusedOnceOnPrefetched = true; prefetchedReply = (JuickMessage) tf.getListView().getAdapter() .getItem(tf.getListView().getAdapter().getCount() - 1); onReplySelected(prefetchedReply); etMessage.requestFocus(); } final String midS = mid.toString(); final SharedPreferences drafts = getSharedPreferences("drafts", MODE_PRIVATE); for (int q = 0; q < 1000; q++) { final String savedMID = drafts.getString("mid" + q, null); if (savedMID != null && savedMID.equals(midS)) { pullDraft(prefetchedReply, drafts, q); break; } } updateDraftsButton(); }
From source file:ru.tinkoff.acquiring.sdk.EnterCardFragment.java
private String getFormattedPrice() { Intent intent = getActivity().getIntent(); Money money = (Money) intent.getSerializableExtra(PayFormActivity.EXTRA_AMOUNT); BigDecimal bigDecimal = new BigDecimal(money.getCoins()); bigDecimal = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_EVEN); return bigDecimal.toString(); }
From source file:net.naonedbus.fragment.impl.ItineraireFragment.java
@Override public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); if (data != null) { final String address = data.getStringExtra("address"); final double latitude = data.getDoubleExtra("latitude", 0d); final double longitude = data.getDoubleExtra("longitude", 0d); final Equipement.Type type = (Type) data.getSerializableExtra("type"); final boolean currentLocation = data.getBooleanExtra("isCurrentLocation", false); if (requestCode == REQUEST_CODE_FROM) { mFromLocation.setLatitude(latitude); mFromLocation.setLongitude(longitude); mFromAddressTextView.setText(address); if (type == null) { mIconFromResId = currentLocation ? R.drawable.ic_action_locate_blue : R.drawable.ic_directions_form_destination_notselected; mIconFromColor = Color.TRANSPARENT; } else { mIconFromResId = type.getDrawableRes(); mIconFromColor = getActivity().getResources().getColor(type.getBackgroundColorRes()); }// w ww . j a va 2s .c o m mFromCurrentLocation = currentLocation; } else { mToLocation.setLatitude(latitude); mToLocation.setLongitude(longitude); mToAddressTextView.setText(address); if (type == null) { mIconFromResId = currentLocation ? R.drawable.ic_action_locate_blue : R.drawable.ic_directions_form_destination_notselected; mIconToColor = Color.TRANSPARENT; } else { mIconToResId = type.getDrawableRes(); mIconToColor = getActivity().getResources().getColor(type.getBackgroundColorRes()); } mToCurrentLocation = currentLocation; } notifyIconsChanged(); } onFormValueChange(); }
From source file:com.teocci.utubinbg.BackgroundAudioService.java
/** * Handles media - playlists and videos sent from fragments * * @param intent//www . java2s .c o m */ private void handleMedia(Intent intent) { int intentMediaType = intent.getIntExtra(Config.YOUTUBE_TYPE, Config.YOUTUBE_MEDIA_NO_NEW_REQUEST); switch (intentMediaType) { case Config.YOUTUBE_MEDIA_NO_NEW_REQUEST: //video is paused,so no new playback requests should be processed mMediaPlayer.start(); break; case Config.YOUTUBE_MEDIA_TYPE_VIDEO: mediaType = Config.YOUTUBE_MEDIA_TYPE_VIDEO; videoItem = (YouTubeVideo) intent.getSerializableExtra(Config.YOUTUBE_TYPE_VIDEO); if (videoItem.getId() != null) { playVideo(); } break; case Config.YOUTUBE_MEDIA_TYPE_PLAYLIST: //new playlist playback request mediaType = Config.YOUTUBE_MEDIA_TYPE_PLAYLIST; youTubeVideos = (ArrayList<YouTubeVideo>) intent.getSerializableExtra(Config.YOUTUBE_TYPE_PLAYLIST); int startPosition = intent.getIntExtra(Config.YOUTUBE_TYPE_PLAYLIST_VIDEO_POS, 0); iterator = youTubeVideos.listIterator(startPosition); playNext(); break; default: Log.d(TAG, "Unknown command"); break; } }
From source file:com.evandroid.musica.MainLyricActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); invalidateOptionsMenu();/*from w w w.j a va 2s .c om*/ LyricsViewFragment lyricsViewFragment = (LyricsViewFragment) getFragmentManager() .findFragmentByTag(LYRICS_FRAGMENT_TAG); if (requestCode == 77) { lyricsViewFragment.checkPreferencesChanges(); } else if (resultCode == RESULT_OK && requestCode == 55) { Lyrics results = (Lyrics) data.getSerializableExtra("lyrics"); updateLyricsFragment(R.animator.slide_out_end, results.getArtist(), results.getTrack(), results.getURL()); lyricsViewFragment.searchResultLock = true; } lyricsViewFragment.updateSearchView(true, null, false); }
From source file:org.kontalk.ui.CodeValidation.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.code_validation_screen); setupToolbar(true, false);// w w w.ja va 2 s . c o m mCode = (EditText) findViewById(R.id.validation_code); mButton = (Button) findViewById(R.id.send_button); mFallbackButton = (Button) findViewById(R.id.fallback_button); mCallButton = (Button) findViewById(R.id.code_validation_call); mProgress = (ProgressBar) findViewById(R.id.progressbar); // configuration change?? RetainData data = (RetainData) getLastCustomNonConfigurationInstance(); if (data != null) { mValidator = data.validator; if (mValidator != null) { startProgress(); mValidator.setListener(this); } mTrustedKeys = data.trustedKeys; } int requestCode = getIntent().getIntExtra("requestCode", -1); if (requestCode == NumberValidation.REQUEST_VALIDATION_CODE || getIntent().getStringExtra("sender") == null) { findViewById(R.id.code_validation_sender).setVisibility(View.GONE); findViewById(R.id.code_validation_intro2).setVisibility(View.GONE); ((TextView) findViewById(R.id.code_validation_intro)).setText(R.string.code_validation_intro_manual); } else { String challenge = getIntent().getStringExtra("challenge"); String sender = getIntent().getStringExtra("sender"); final TextView senderText = (TextView) findViewById(R.id.code_validation_sender); CharSequence textId1, textId2; if (NumberValidator.isMissedCall(sender) || NumberValidator.CHALLENGE_MISSED_CALL.equals(challenge)) { // reverse missed call textId1 = getText(R.string.code_validation_intro_missed_call); textId2 = getString(R.string.code_validation_intro2_missed_call, NumberValidator.getChallengeLength(sender)); mFallbackButton.setText(R.string.button_validation_fallback); mFallbackButton.setVisibility(View.VISIBLE); // show sender label and hide call button senderText.setText(sender); senderText.setVisibility(View.VISIBLE); mCallButton.setVisibility(View.GONE); mCode.setVisibility(View.VISIBLE); } else if (NumberValidator.CHALLENGE_CALLER_ID.equals(challenge)) { // user-initiated missed call textId1 = getText(R.string.code_validation_intro_callerid); textId2 = getText(R.string.code_validation_intro2_callerid); mFallbackButton.setText(R.string.button_validation_fallback_callerid); mFallbackButton.setVisibility(View.VISIBLE); // show call button and hide sender label mCallButton.setText(sender); mCallButton.setVisibility(View.VISIBLE); senderText.setVisibility(View.GONE); mCode.setVisibility(View.GONE); } else { // PIN code textId1 = getText(R.string.code_validation_intro); textId2 = getText(R.string.code_validation_intro2); mFallbackButton.setVisibility(View.GONE); // show sender label and hide call button senderText.setText(sender); senderText.setVisibility(View.VISIBLE); mCallButton.setVisibility(View.GONE); mCode.setVisibility(View.VISIBLE); } if (mCallButton.getVisibility() == View.VISIBLE) { mCallButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { SystemUtils.dial(CodeValidation.this, mCallButton.getText()); } }); } ((TextView) findViewById(R.id.code_validation_intro)).setText(textId1); ((TextView) findViewById(R.id.code_validation_intro2)).setText(textId2); } Intent i = getIntent(); mKey = i.getParcelableExtra(KeyPairGeneratorService.EXTRA_KEY); mName = i.getStringExtra("name"); mPhone = i.getStringExtra("phone"); mForce = i.getBooleanExtra("force", false); mPassphrase = i.getStringExtra("passphrase"); mImportedPrivateKey = i.getByteArrayExtra("importedPrivateKey"); mImportedPublicKey = i.getByteArrayExtra("importedPublicKey"); mTrustedKeys = (HashMap) i.getSerializableExtra("trustedKeys"); String server = i.getStringExtra("server"); if (server != null) mServerProvider = new EndpointServer.SingleServerProvider(server); else /* * FIXME HUGE problem here. If we already have a verification code, * how are we supposed to know from what server it came from?? * https://github.com/kontalk/androidclient/issues/118 */ mServerProvider = Preferences.getEndpointServerProvider(this); }