List of usage examples for android.content Intent getSerializableExtra
public Serializable getSerializableExtra(String name)
From source file:mx.itesm.logistics.crew_tracking.activity.ShopListActivity.java
@Override public void onResult(int requestCode, int resultCode, final Intent data) { if (resultCode != TargetListener.RESULT_OK) return;/*from w w w. j av a2 s . c o m*/ switch (requestCode) { case REQUEST_SHOP: Intent intent = new Intent(); intent.putExtra(EXTRA_SHOP, data.getSerializableExtra(ShopListFragment.EXTRA_CARD)); setResult(Activity.RESULT_OK, intent); finish(); break; } }
From source file:com.mycelium.wallet.activity.AddRecordActivity.java
@Override public void onActivityResult(final int requestCode, final int resultCode, final Intent intent) { if (requestCode == SCAN_RESULT_CODE) { if (resultCode == Activity.RESULT_OK) { Record record = (Record) intent.getSerializableExtra(ScanActivity.RESULT_RECORD_KEY); finishOk(record, BackupState.VERIFIED); } else {//www .j a v a 2 s . com ScanActivity.toastScanError(resultCode, intent, this); } } else if (requestCode == CREATE_RESULT_CODE && resultCode == Activity.RESULT_OK) { String base58Key = intent.getStringExtra("base58key"); Record record = Record.recordFromBase58Key(base58Key, _network); // Since the record is extracted from SIPA format the source defaults // to SIPA, set it to CREATED record.source = Source.CREATED_PRIVATE_KEY; finishOk(record, BackupState.UNKNOWN); } else { super.onActivityResult(requestCode, resultCode, intent); } }
From source file:com.ririjin.adminmobile.fragment.BasicFragment.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub moneyDetails = (MoneyDetails) data.getSerializableExtra("money_details"); AppraiserAsses.setText("" + moneyDetails.getActual_borrow_money()); super.onActivityResult(requestCode, resultCode, data); }
From source file:io.github.runassudo.ptoffline.activities.TripDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_trip_details); getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); TransportNetwork network = Preferences.getTransportNetwork(this); showLineName = network != null && network.hasGoodLineNames(); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); if (toolbar != null) { if (network != null) toolbar.setSubtitle(network.getName()); setSupportActionBar(toolbar);//from ww w .j a v a 2s. co m ActionBar actionBar = getSupportActionBar(); if (actionBar != null) actionBar.setDisplayHomeAsUpEnabled(true); } final Intent intent = getIntent(); trip = (Trip) intent.getSerializableExtra("io.github.runassudo.ptoffline.pte.dto.Trip"); ui = new TripAdapter.BaseTripHolder(findViewById(R.id.cardView), trip.legs.size()); // retrieve trip data from intent that is not stored properly in trip object from = (Location) intent.getSerializableExtra("io.github.runassudo.ptoffline.pte.dto.Trip.from"); to = (Location) intent.getSerializableExtra("io.github.runassudo.ptoffline.pte.dto.Trip.to"); products = (ArrayList<Product>) intent .getSerializableExtra("io.github.runassudo.ptoffline.pte.dto.Trip.products"); setHeader(); setTrip(trip); }
From source file:mx.itesm.logistics.crew_tracking.activity.DeliveryNewActivity.java
@Override public void onResult(int requestCode, int resultCode, final Intent data) { if (resultCode != TargetListener.RESULT_OK) return;/*from www .j a v a 2 s . co m*/ switch (requestCode) { case REQUEST_DELIVERY: Intent intent = new Intent(); intent.putExtra(EXTRA_DELIVERY, data.getSerializableExtra(DeliveryFormFragment.EXTRA_DELIVERY)); setResult(Activity.RESULT_OK, intent); finish(); break; } }
From source file:com.vv.androidreview.ui.activites.ListActivity.java
private void initArguments() { Intent intent = getIntent(); if (intent != null) { mType = intent.getIntExtra(CONTENT_TYPE_KEY, -1); switch (mType) { case LIST_TYPE_REVIEW_CONTENT: mPoint = (Point) intent.getSerializableExtra(ReviewFragment.ARGUMENT_POINT_KEY); break; case LIST_TYPE_FAV_TEST: break; }/*from w w w. ja v a 2 s . c o m*/ } }
From source file:com.survivingwithandroid.socialp.LoginService.java
@Override protected void onHandleIntent(Intent intent) { Log.d("Prf", "Login service"); SocialProfile socialProfile = null;//www . j a v a 2s . com Profile profile = null; if (intent != null) socialProfile = (SocialProfile) intent.getSerializableExtra(LoginService.PROFILE_INFO); switch (socialProfile) { case FACEBOOK: profile = getFacebookProfile(); break; case GOOGLE_PLUS: profile = getGoogleProfile(); break; case TWITTER: profile = getTwitterProfile(); break; case LINKEDIN: profile = getLinkedinProfile(); break; case GITHUB: profile = getGithubProfile(); break; } String fullName = profile.getFullName(); String email = profile.getEmail(); String url = profile.getPictureURL(); sendBroatcast(fullName, email, url); }
From source file:com.solidparts.gifts.gcm.RegistrationIntentService.java
@Override protected void onHandleIntent(Intent intent) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); userDTO = (UserDTO) intent.getSerializableExtra("userDTO"); userService = new UserService(this); messageManager = new MessageManager(); try {/*www .j a v a 2 s. c o m*/ // [START register_for_gcm] // Initially this call goes out to the network to retrieve the token, subsequent calls // are local. // R.string.gcm_defaultSenderId (the Sender ID) is typically derived from google-services.json. // See https://developers.google.com/cloud-messaging/android/start for details on this file. // [START get_token] InstanceID instanceID = InstanceID.getInstance(this); String token = instanceID.getToken(getString(R.string.gcm_defaultSenderId), GoogleCloudMessaging.INSTANCE_ID_SCOPE, null); // [END get_token] Log.i(TAG, "GCM Registration Token: " + token); // TODO: Implement this method to send any registration to your app's servers. if (userDTO.getGcm_regid() == null || userDTO.getGcm_regid().equals("")) { sendRegistrationToServer(token); } // Subscribe to topic channels subscribeTopics(token); // You should store a boolean that indicates whether the generated token has been // sent to your server. If the boolean is false, send the token to your server, // otherwise your server should have already received the token. sharedPreferences.edit().putBoolean(QuickstartPreferences.SENT_TOKEN_TO_SERVER, true).apply(); // [END register_for_gcm] } catch (Exception e) { Log.d(TAG, "Failed to complete token refresh", e); // If an exception happens while fetching the new token or updating our registration data // on a third-party server, this ensures that we'll attempt the update at a later time. sharedPreferences.edit().putBoolean(QuickstartPreferences.SENT_TOKEN_TO_SERVER, false).apply(); } // Notify UI that registration has completed, so the progress indicator can be hidden. Intent registrationComplete = new Intent(QuickstartPreferences.REGISTRATION_COMPLETE); LocalBroadcastManager.getInstance(this).sendBroadcast(registrationComplete); }
From source file:eu.power_switch.gui.activity.RoomsActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // set Theme before anything else in onCreate ThemeHelper.applyTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.activity_rooms); // allow always-on screen setAmbientEnabled();/* ww w .ja v a 2 s. co m*/ dataApiHandler = new DataApiHandler(getApplicationContext()); // BroadcastReceiver to get notifications from background service if room data has changed broadcastReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.d("MainActivity", "received intent: " + intent.getAction()); ArrayList<Room> rooms = (ArrayList<Room>) intent.getSerializableExtra(ListenerService.ROOM_DATA); replaceRoomList(rooms); refreshUI(); } }; final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub); stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() { @Override public void onLayoutInflated(WatchViewStub stub) { relativeLayoutAmbientMode = (RelativeLayout) findViewById(R.id.relativeLayout_ambientMode); roomsRecyclerView = (RecyclerView) findViewById(R.id.rooms_recyclerView); roomsRecyclerViewAdapter = new RoomRecyclerViewAdapter(stub.getContext(), roomsRecyclerView, roomList, dataApiHandler); roomsRecyclerView.setAdapter(roomsRecyclerViewAdapter); SnappingLinearLayoutManager layoutManager = new SnappingLinearLayoutManager(getApplicationContext(), LinearLayoutManager.VERTICAL, false); roomsRecyclerView.setLayoutManager(layoutManager); } }); }
From source file:de.WyLight.WyLight.WiflyControlActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (null != savedInstanceState) { mARGB = savedInstanceState.getInt(STATE_KEY_COLOR, 0xffffffff); Color.colorToHSV(mARGB, mHSV); }// w w w. j ava 2s . c om setContentView(R.layout.view_pager); ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); actionBar.setDisplayShowTitleEnabled(false); final ViewPager pager = (ViewPager) findViewById(R.id.pager); final WiflyPagerAdapter adapter = new WiflyPagerAdapter(getFragmentManager()); pager.setAdapter(adapter); pager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { public void onPageScrolled(int arg0, float arg1, int arg2) { /* not implemented */ } public void onPageScrollStateChanged(int arg0) { /* not implemented */ } public void onPageSelected(int arg0) { getActionBar().setSelectedNavigationItem(arg0); mFragments[arg0].onShow(mMenu); } }); TabListener listener = new TabListener(pager); for (int i = 0; i < pager.getAdapter().getCount(); ++i) { Tab tab = actionBar.newTab().setIcon(mFragments[i].getIcon()).setTabListener(listener); actionBar.addTab(tab); } Intent i = getIntent(); mRemote = (Endpoint) i.getSerializableExtra(EXTRA_ENDPOINT); }