List of usage examples for android.content Intent getSerializableExtra
public Serializable getSerializableExtra(String name)
From source file:org.irmacard.androidmanagement.CredentialListActivity.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == SETTINGS_REQUEST) { if (resultCode == SettingsActivity.RESULT_CHANGE_CARD_PIN) onChangeCardPIN();// w ww. ja v a 2 s.c o m else if (resultCode == SettingsActivity.RESULT_CHANGE_CRED_PIN) onChangeCredPIN(); } else if (requestCode == DETAIL_REQUEST) { if (resultCode == CredentialDetailActivity.RESULT_DELETE) { CredentialDescription cd = (CredentialDescription) data .getSerializableExtra(CredentialDetailActivity.ARG_RESULT_DELETE); onDeleteCredential(cd); } } }
From source file:org.inaturalist.android.GuideDetails.java
/** Called when the activity is first created. */ @Override//from ww w . ja va 2s . c om public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.guide_details); mHandler = new Handler(); mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); mGuideMenu = (ListView) findViewById(R.id.guide_menu); mFilter = new GuideTaxonFilter(); ActionBar actionBar = getSupportActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setIcon(android.R.color.transparent); final Intent intent = getIntent(); if (mApp == null) { mApp = (INaturalistApp) getApplicationContext(); } if (savedInstanceState == null) { mGuide = (BetterJSONObject) intent.getSerializableExtra("guide"); } else { mGuide = (BetterJSONObject) savedInstanceState.getSerializable("guide"); mGuideXmlFilename = savedInstanceState.getString("guideXmlFilename"); if (mGuideXmlFilename != null) mGuideXml = new GuideXML(GuideDetails.this, mGuide.getInt("id").toString(), mGuideXmlFilename); mFilter.setSearchText(savedInstanceState.getString("filterSearchText")); mFilter.setTags(savedInstanceState.getStringArrayList("filterTags")); mIsDownloading = savedInstanceState.getBoolean("isDownloading"); mDownloadProgress = savedInstanceState.getInt("downloadProgress", 0); } if (mGuide == null) { finish(); return; } actionBar.setTitle(mGuide.getString("title")); mTaxaGuideReceiver = new GuideTaxaReceiver(); IntentFilter filter = new IntentFilter(INaturalistService.ACTION_GUIDE_XML_RESULT); Log.i(TAG, "Registering ACTION_GUIDE_XML_RESULT"); registerReceiver(mTaxaGuideReceiver, filter); mSearchText = (EditText) findViewById(R.id.search_filter); mSearchText.setEnabled(false); mSearchText.setText(mFilter.getSearchText()); mSearchText.addTextChangedListener(new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { if (mAdapter != null) { mFilter.setSearchText(s.toString()); if (mTypingTask != null) { mHandler.removeCallbacks(mTypingTask); } mTypingTask = new Runnable() { @Override public void run() { updateTaxaByFilter(); } }; mHandler.postDelayed(mTypingTask, 400); } } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { } }); mProgress = (ProgressBar) findViewById(R.id.progress); mTaxaEmpty = (TextView) findViewById(R.id.guide_taxa_empty); mGuideTaxaGrid = (GridViewExtended) findViewById(R.id.taxa_grid); mGuideTaxaGrid.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { GuideTaxonXML taxon = (GuideTaxonXML) arg1.getTag(); // Show taxon details Intent intent = new Intent(GuideDetails.this, GuideTaxonActivity.class); intent.putExtra("guide_taxon", true); intent.putExtra("guide_id", mGuideXml.getID()); intent.putExtra("taxon_id", taxon.getTaxonId()); intent.putExtra("guide_xml_filename", mGuideXmlFilename); startActivity(intent); } }); mProgress.setVisibility(View.VISIBLE); mGuideTaxaGrid.setVisibility(View.GONE); mTaxaEmpty.setVisibility(View.GONE); if (mGuideXml == null) { // Get the guide's XML file int guideId = mGuide.getInt("id"); Intent serviceIntent = new Intent(INaturalistService.ACTION_GUIDE_XML, null, GuideDetails.this, INaturalistService.class); serviceIntent.putExtra(INaturalistService.ACTION_GUIDE_ID, guideId); startService(serviceIntent); } LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); View footerView = inflater.inflate(R.layout.guide_menu_footer, null, false); mDescription = (TextView) footerView.findViewById(R.id.description); mEditorName = (TextView) footerView.findViewById(R.id.editorName); mLicense = (TextView) footerView.findViewById(R.id.license); mDownloadTitle = (TextView) footerView.findViewById(R.id.downloadTitle); mDownloadSubtitle = (TextView) footerView.findViewById(R.id.downloadSubtitle); mDownloadingSubtitle = (TextView) footerView.findViewById(R.id.downloadingSubtitle); mDownloadGuideImage = (ImageView) footerView.findViewById(R.id.downloadGuideImage); mDownloadingGuide = (View) footerView.findViewById(R.id.downloadingGuide); mDownloadingProgress = (ProgressBar) footerView.findViewById(R.id.downloadingProgress); mDownloadGuide = (View) footerView.findViewById(R.id.downloadGuide); mGuideMenu.addFooterView(footerView); if (mIsDownloading) { refreshGuideSideMenu(); mApp.setDownloadCallback(this); } if (mGuideXml != null) { mTaxa = new ArrayList<GuideTaxonXML>(); mAdapter = new TaxaListAdapter(GuideDetails.this, mTaxa); updateTaxaByFilter(); mProgress.setVisibility(View.GONE); updateSideMenu(); } }
From source file:timer.com.maydaysdk.MayDayMessageChatFragment.java
@Override public void onResume() { super.onResume(); //Incoming message handled Intent finalIntent = getActivity().getIntent(); if (finalIntent.getExtras() != null) { //Get incoming message form other device/browser if (finalIntent.getAction().equals(RCDevice.INCOMING_MESSAGE)) { //Get incoming message text form other device/browser String message = finalIntent.getStringExtra(RCDevice.INCOMING_MESSAGE_TEXT); if (message != null) { //If incoming message is chat close encrypt key,Then close the chat. if (message.equalsIgnoreCase(MayDayConstant.CHAT_CLOSE_ENCRYPT_KEY)) { mCallBackInterface.onMayDayClose(); } else { //If incoming message is not chat close encrypt key(Some text) then display in the chat view. HashMap<String, String> intentParams = (HashMap<String, String>) finalIntent .getSerializableExtra(RCDevice.INCOMING_MESSAGE_PARAMS); String username = intentParams.get(MayDayConstant.USERNAME); String shortName = username.replaceAll("^sip:", "").replaceAll("@.*$", ""); mMessageParams.put(MayDayConstant.USERNAME, username); mListFragment.addRemoteMessage(message, shortName); //Display chat name on the header of the chat view. mTextViewAgentName.setText(shortName); }//from w w w. j a va 2s. c om } } } }
From source file:im.vector.activity.VectorHomeActivity.java
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); mAutomaticallyOpenedRoomParams = (Map<String, Object>) intent .getSerializableExtra(EXTRA_JUMP_TO_ROOM_PARAMS); mUniversalLinkToOpen = intent.getParcelableExtra(EXTRA_JUMP_TO_UNIVERSAL_LINK); // start waiting view if (intent.getBooleanExtra(EXTRA_WAITING_VIEW_STATUS, VectorHomeActivity.WAITING_VIEW_STOP)) { showWaitingView();/*from www.ja v a2 s .c o m*/ } else { stopWaitingView(); } }
From source file:de.uni.stuttgart.informatik.ToureNPlaner.UI.Activities.MapScreen.MapScreen.java
@Override @SuppressWarnings("unchecked") protected void onActivityResult(int requestCode, int resultCode, Intent data) { Edit edit;// w w w .j a v a 2 s .co m switch (requestCode) { case REQUEST_NODEMODEL: switch (resultCode) { case RESULT_OK: edit = new ChangeNodeModelEdit(session, (ArrayList<Node>) data.getExtras().getSerializable(NodeModel.IDENTIFIER)); edit.perform(); break; } break; case REQUEST_NODE: switch (resultCode) { case RESULT_OK: edit = new UpdateNodeEdit(session, data.getExtras().getInt("index"), (Node) data.getSerializableExtra("node")); edit.perform(); break; case EditNodeScreen.RESULT_DELETE: edit = new RemoveNodeEdit(session, data.getExtras().getInt("index")); edit.perform(); break; } break; case REQUEST_CONSTRAINTS: switch (resultCode) { case RESULT_OK: ArrayList<Constraint> constraints = (ArrayList<Constraint>) data.getExtras() .get(AlgorithmConstraintsScreen.IDENTIFIER); edit = new ChangeConstraintsEdit(session, constraints); edit.perform(); } break; } }
From source file:com.nttec.everychan.ui.downloading.DownloadingService.java
@Override public void onStart(Intent intent, int startId) { if (intent != null) { DownloadingQueueItem item = (DownloadingQueueItem) intent.getSerializableExtra(EXTRA_DOWNLOADING_ITEM); if (item != null) downloadingQueue.add(item);/*from ww w . ja va 2 s . c o m*/ } if (currentTask == null || !nowTaskRunning) { Logger.d(TAG, "starting downloading task"); nowTaskRunning = true; currentTask = new DownloadingTask(startId); sCurrentTask = currentTask; Async.runAsync(currentTask); } else { Logger.d(TAG, "item added to download queue"); if (progressNotifBuilder != null) { progressNotifBuilder .setContentTitle(getString(R.string.downloading_title, downloadingQueue.size() + 1)); notifyForeground(DOWNLOADING_NOTIFICATION_ID, progressNotifBuilder.build()); } sendBroadcast(new Intent(BROADCAST_UPDATED)); currentTask.setStartId(startId); } }
From source file:com.xunlei.shortvideo.activity.VideoPublishLocal3Activity.java
@Override protected void initFromIntent(Intent intent) { mVideo = (ShortVideo) intent.getSerializableExtra(EXTRA_SHORT_VIDEO); mProjectUri = intent.getParcelableExtra(EXTRA_VIDEO_PROJECT); if (mVideo != null) { // mVideoPath = mVideo.videoUrl; }//from ww w . ja va2 s . co m }
From source file:com.example.innf.newchangtu.Map.view.activity.MainActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode != Activity.RESULT_OK) { return;/*www . jav a 2 s.c o m*/ } if (requestCode == REQUEST_CODE) { mTrack = (Track) data.getSerializableExtra(StartRecordActivity.EXTRA_TRACK); mTimeInterval = data.getIntExtra(StartRecordActivity.EXTRA_TIME_INTERVAL, 0); mStartPosition = data.getStringExtra(StartRecordActivity.EXTRA_START); mEndPosition = mStartPosition; mPhone = data.getStringExtra(StartRecordActivity.EXTRA_PHONE); Log.i(TAG, "/*************************/"); Log.i(TAG, mTrack.toString()); Log.i(TAG, mStartPosition); Log.i(TAG, mEndPosition); Log.i(TAG, mTimeInterval + ""); Log.i(TAG, mPhone); Log.i(TAG, "/*************************/"); Position position = new Position(); position.setPosition(getStatus()); position.setMessage(""); position.setLatitude(mLatitude); position.setLongitude(mLongitude); mPositionList.clear(); mPositionList.add(position); mTrack.setPositionList(mPositionList); isPositionEmpty(mPositionList); updateTrack(mTrack); updateUI(); mHandler.postDelayed(mRunnable, mTimeInterval * 60 * 1000); } else if (requestCode == REQUEST_TRACK_PHOTO) { if (isSdcardExisting()) { uploadImage(); } else { showToast("?SD?"); } } }
From source file:com.tcl.lzhang1.mymusic.ui.MusicListAcitivity.java
@Override public void getPreActivityData(Bundle bundle) { // TODO Auto-generated method stub Intent intent = getIntent(); if (null != intent) { SongsWrap songWrap = (SongsWrap) intent.getSerializableExtra("songs"); curStartMode = intent.getIntExtra("startmode", 0); if (curStartMode == 0) { Log.d(TAG, "you should provide the start mode value"); finish();//from w w w .ja va2s . c om return; } if (null != songWrap) { mSongs = songWrap.getModels(); } // List<SongModel> mSongModels = new ArrayList<SongModel>(); if (curStartMode == START_MODE_FAV) { for (SongModel songModel : mSongs) { if (songModel.getFav() == 1) { mSongModels.add(songModel); } } mSongs = mSongModels; mSongModels = null; } else if (curStartMode == START_MODE_ALBUM) { mAlbumname = bundle.getString("albumname"); } else if (curStartMode == START_MODE_SINGER) { mSingerName = bundle.getString("singername"); } } }
From source file:org.geometerplus.android.fbreader.network.NetworkLibraryActivity.java
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Connection.bindToService(this, new Runnable() { public void run() { getListView().invalidateViews(); }/*from w w w . ja v a 2s . c o m*/ }); if (resultCode != RESULT_OK || data == null) { return; } switch (requestCode) { case REQUEST_MANAGE_CATALOGS: { final ArrayList<String> myIds = data.getStringArrayListExtra(ENABLED_CATALOG_IDS_KEY); NetworkLibrary.Instance().setActiveIds(myIds); NetworkLibrary.Instance().synchronize(); break; } case REQUEST_AUTHORISATION_SCREEN: { final CookieStore store = ZLNetworkManager.Instance().cookieStore(); final Map<String, String> cookies = (Map<String, String>) data.getSerializableExtra(COOKIES_KEY); if (cookies == null) { break; } for (Map.Entry<String, String> entry : cookies.entrySet()) { final BasicClientCookie2 c = new BasicClientCookie2(entry.getKey(), entry.getValue()); c.setDomain(data.getData().getHost()); c.setPath("/"); final Calendar expire = Calendar.getInstance(); expire.add(Calendar.YEAR, 1); c.setExpiryDate(expire.getTime()); c.setSecure(true); c.setDiscard(false); store.addCookie(c); } final NetworkTree tree = getTreeByKey((FBTree.Key) data.getSerializableExtra(TREE_KEY_KEY)); new ReloadCatalogAction(this).run(tree); break; } } }