List of usage examples for android.os Bundle getSerializable
@Override
@Nullable
public Serializable getSerializable(@Nullable String key)
From source file:com.hector.invoice.views.TabExportInvoiceOrder.java
@Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); // Inflate the layout setContentView(R.layout.layout_export_invoice_order_view); this.initControlView(); Bundle data = this.getIntent().getExtras(); if (data.getSerializable(IntentConstants.INTENT_INVOICE_INFO) != null) { this.invoiceInfo = (InvoiceOrderNumberInfoView) data .getSerializable(IntentConstants.INTENT_INVOICE_INFO); }// w ww . j av a 2 s .com if (data.getSerializable(IntentConstants.INTENT_COMPANY_INFO) != null) { this.myCompany = (CompanyDTO) data.getSerializable(IntentConstants.INTENT_COMPANY_INFO); } if (data.getString(IntentConstants.INTENT_FILE_NAME_PDF1) != null) { this.fileNamePDF_R = data.getString(IntentConstants.INTENT_FILE_NAME_PDF1); } if (data.getString(IntentConstants.INTENT_FILE_NAME_PDF2) != null) { this.fileNamePDF_L = data.getString(IntentConstants.INTENT_FILE_NAME_PDF2); } if (data.getString(IntentConstants.INTENT_FILE_NAME_PDF3) != null) { this.fileNamePDF_A = data.getString(IntentConstants.INTENT_FILE_NAME_PDF3); } this.initialiseTabHost(savedInstanceState); if (savedInstanceState != null) { mTabHost.setCurrentTabByTag(savedInstanceState.getString(IntentConstants.INTENT_CURRENT_TAB_SELECTED)); this.currentScreenIndex = mTabHost.getCurrentTab(); } else { this.currentScreenIndex = 0; } // Intialise ViewPager this.intialiseViewPager(); }
From source file:com.sakisds.icymonitor.fragments.graph.GraphFragment.java
public void onRestoreInstanceState(Bundle savedState) { // restore the current data, for instance when changing the screen orientation mDataset = (XYMultipleSeriesDataset) savedState.getSerializable("dataset"); mRenderer = (XYMultipleSeriesRenderer) savedState.getSerializable("renderer"); if (savedState.getBoolean("notNull")) { int length = savedState.getInt("seriesLength"); mSeries = new XYSeries[length]; mSeriesRenderer = new XYSeriesRenderer[length]; for (int i = 0; i < length; i++) { mSeries[i] = (XYSeries) savedState.getSerializable("current_series_" + i); mSeriesRenderer[i] = (XYSeriesRenderer) savedState.getSerializable("current_renderer_" + i); }/*from www. j a v a 2 s . co m*/ mGraphX = savedState.getInt("x"); } }
From source file:org.mifos.androidclient.main.LastRepaymentReportActivity.java
@Override public void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.last_repayment_report); if (bundle != null && bundle.containsKey(CustomersData.BUNDLE_KEY)) { mLastRepayments = Arrays.asList((LastRepayment[]) bundle.getSerializable(LastRepayment.BUNDLE_KEY)); }/* w w w. j a v a2s .c o m*/ mFilterBox = (EditText) findViewById(R.id.lastRepayment_filter_box); mLastLoanList = (ExpandableListView) findViewById(R.id.lastRepayment_list); mContent = (LinearLayout) findViewById(R.id.lastRepayment_content); mMessage = (TextView) findViewById(R.id.lastRepayment_noDataMessage); mCustomerService = new CustomerService(this); }
From source file:com.docd.purefm.ui.dialogs.PartitionInfoDialog.java
@Override public void onCreate(Bundle state) { super.onCreate(state); final Bundle args = this.getArguments(); if (args == null) { throw new RuntimeException( "Arguments were not supplied. The DialogFragment should be obtained by instantiate(GenericFile) method"); }// w w w . j a va 2 s. com this.mFile = (GenericFile) args.getSerializable(Extras.EXTRA_FILE); }
From source file:eu.trentorise.smartcampus.eb.fragments.experience.ExperiencePager.java
@SuppressWarnings("unchecked") @Override/*from www .ja va2 s .c om*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.exp_fragment_pager); if (savedInstanceState != null && savedInstanceState.containsKey(ARG_COLLECTION)) { collection = (ArrayList<Experience>) savedInstanceState.getSerializable(ARG_COLLECTION); // position = savedInstanceState.getInt(ARG_POSITION); } else if (getIntent() != null) { collection = (ArrayList<Experience>) getIntent().getSerializableExtra(ARG_COLLECTION); // position = getArguments().getInt(ARG_POSITION); } else { collection = new ArrayList<Experience>(); // position = 0; } mAdapter = new ExperiencePagerAdapter(getSupportFragmentManager()); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mAdapter); int currentIdx = getIntent().getIntExtra(ARG_POSITION, 0); mPager.setCurrentItem(currentIdx); setCurrentIdFromIdx(currentIdx); mPager.setOnPageChangeListener(new OnPageChangeListener() { @Override public void onPageSelected(int currentIdx) { setCurrentIdFromIdx(currentIdx); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); }
From source file:com.balch.auctionbrowser.auction.AuctionDetailDialog.java
@Override public void onStart() { super.onStart(); ((AlertDialog) getDialog()).getButton(AlertDialog.BUTTON_NEGATIVE).setEnabled(false); ((AlertDialog) getDialog()).getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false); noteEditText = (EditText) getDialog().findViewById(R.id.auction_detail_note); boolean enableSaveButtons = false; Bundle args = getArguments(); if (args != null) { if (args.containsKey(ARG_NOTE)) { noteEditText.setText(args.getString(ARG_NOTE)); }/*from w w w .j a v a 2 s. c om*/ if (args.containsKey(ARG_AUCTION)) { Auction auction = (Auction) args.getSerializable(ARG_AUCTION); enableSaveButtons = (auction.getItemId() != -1L); TextView tv = (TextView) getDialog().findViewById(R.id.auction_detail_title); tv.setText(auction.getTitle()); NetworkImageView profileImageView = (NetworkImageView) getDialog() .findViewById(R.id.auction_detail_item_img); profileImageView.setImageUrl(auction.getImageUrl(), ((ModelProvider) getActivity().getApplication()).getImageLoader()); LabelTextView ltv = (LabelTextView) getDialog().findViewById(R.id.auction_detail_end_time); ltv.setValue(DATE_TIME_FORMAT.format(auction.getEndTime())); ltv = (LabelTextView) getDialog().findViewById(R.id.auction_detail_price); ltv.setValue(auction.getCurrentPrice().getFormatted(2)); ltv = (LabelTextView) getDialog().findViewById(R.id.auction_detail_location); ltv.setValue(auction.getLocation()); if (auction.getShippingCost() != null) { ltv = (LabelTextView) getDialog().findViewById(R.id.auction_detail_shipping_cost); ltv.setValue(auction.getShippingCost().getFormatted(2)); } ltv = (LabelTextView) getDialog().findViewById(R.id.auction_detail_buy_it_now); ltv.setValue(auction.isBuyItNow() ? "\u2714" : "\u2718"); } } Button saveButton = (Button) getDialog().findViewById(R.id.member_detail_button_save); Button clearButton = (Button) getDialog().findViewById(R.id.member_detail_button_clear); if (enableSaveButtons) { saveButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (noteDetailDialogListener != null) { noteDetailDialogListener.onSave(noteEditText.getText().toString()); } dismiss(); } }); clearButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (noteDetailDialogListener != null) { noteDetailDialogListener.onClear(); } dismiss(); } }); } else { saveButton.setVisibility(View.GONE); clearButton.setVisibility(View.GONE); } }
From source file:br.ufsc.das.gtscted.shibbauth.ShibAuthenticationActivity.java
/** Called when the activity is first created. */ @Override// ww w . j a v a 2 s .c o m public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.idp_selection); loginButton = (Button) findViewById(R.id.loginButton); backButton = (Button) findViewById(R.id.backButton); usernameTxt = (EditText) findViewById(R.id.usernameTxt); passwordTxt = (EditText) findViewById(R.id.passwordTxt); idpSpinner = (Spinner) findViewById(R.id.idpSpinner); //Configura o ArrayAdapter do spinner. ArrayAdapter<CharSequence> spinnerArrayAdapter; spinnerArrayAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item); spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); idpSpinner.setAdapter(spinnerArrayAdapter); // Obtm os parmetros passados pela Activity anterior // (no caso, a pgina do WAYF como uma String e o // nico cookie da Connection usada anteriormente) Bundle bundle = this.getIntent().getExtras(); String wayfHtml = bundle.getString("html_source"); final String wayfLocation = bundle.getString("wayf_location"); final SerializableCookie receivedCookie = (SerializableCookie) bundle.getSerializable("cookie"); //Obtm todos os tags de nome "option", que correspondem // aos IdPs, da pgina do WAYF. Document wayfDocument = Jsoup.parse(wayfHtml); idpElements = wayfDocument.select("option"); //Popula o spinner com os nomes dos IdPs encontrados. for (Element idpElement : idpElements) { String idpName = idpElement.text(); spinnerArrayAdapter.add(idpName); } // Obtm o caminho para o qual deve ser passado o IdP do usurio. formElements = wayfDocument.select("form"); for (Element formElement : formElements) { if (formElement.attr("id").equals("IdPList")) { wayfActionPath = formElement.attr("action"); } } loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // Obtm a URL correspondente ao idP selecionado no spinner. int selectedIdpPosition = idpSpinner.getSelectedItemPosition(); Element selectedIdp = idpElements.get(selectedIdpPosition); selectedIdpUrl = selectedIdp.attr("value"); try { // Obtm os campos "username" e "password" fornecidos // pelo usurio e necessrios para a autenticao. String username = usernameTxt.getText().toString(); String password = passwordTxt.getText().toString(); // Cria um novo objeto Connection, e adiciona o // cookie passado pela Activity anterior. Connection connection = new Connection(); BasicClientCookie newCookie = new BasicClientCookie(receivedCookie.getName(), receivedCookie.getValue()); newCookie.setDomain(receivedCookie.getDomain()); connection.addCookie(newCookie); // Tenta realizar a autenticao no IdP selecionado. O resultado corresponde // pgina para a qual o cliente redirecionado em caso de autenticao // bem-sucedida. String authResult = connection.authenticate(wayfLocation, wayfActionPath, selectedIdpUrl, username, password); // Apenas mostra o recurso que o usurio queria acessar (neste caso, mostra a pg. de // "Homologao de atributos"). Intent newIntent = new Intent(ShibAuthenticationActivity.this.getApplicationContext(), TestActivity.class); Bundle bundle = new Bundle(); bundle.putString("arg", authResult); newIntent.putExtras(bundle); startActivity(newIntent); } catch (IOException e) { String message = "IOException - problema na conexo"; Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG); toast.show(); } catch (Exception e) { String message = "Exception - problema na autenticao"; Toast toast = Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG); toast.show(); } } }); backButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); }
From source file:com.tenmiles.helpstack.fragments.NewIssueFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { setHasOptionsMenu(true);// w ww .j a v a 2s. co m View rootView = inflater.inflate(R.layout.hs_fragment_new_issue, container, false); this.subjectField = (EditText) rootView.findViewById(R.id.subjectField); this.messageField = (EditText) rootView.findViewById(R.id.messageField); this.imageView1 = (ImageView) rootView.findViewById(R.id.imageView1); this.imageView1.setOnClickListener(attachmentClickListener); // Read user value Bundle args = savedInstanceState; if (args == null) { args = getArguments(); } userDetails = (HSUser) args.getSerializable(EXTRAS_USER); gearSource = new HSSource(getActivity()); if (!HSHelpStack.getInstance(getActivity()).getShowCredits()) { rootView.findViewById(R.id.footerTextLabel).setVisibility(View.GONE); rootView.findViewById(R.id.footerDivider).setVisibility(View.GONE); } return rootView; }
From source file:ca.farrelltonsolar.classic.ChargeControllers.java
public void update(Bundle info, String deviceIpAddress, int port, boolean useUnitIdAsKey) { int unitId = info.getInt("UnitID"); String unitName = info.getString("UnitName"); DeviceType deviceType = (DeviceType) info.getSerializable("DeviceType"); boolean hasWhizbang = info.getBoolean("FoundWhizbang"); boolean updated = false; synchronized (devices) { for (ChargeController cc : devices) { if (useUnitIdAsKey ? cc.unitID() == unitId : (deviceIpAddress.compareTo(cc.deviceIpAddress()) == 0 && port == cc.port())) { if (cc.setUnitID(unitId)) { updated = true;// w ww.j a v a 2 s .co m } if (cc.setDeviceName(unitName)) { updated = true; } if (cc.setDeviceIP(deviceIpAddress)) { updated = true; } if (cc.setPort(port)) { updated = true; } if (cc.setDeviceType(deviceType)) { updated = true; } if (cc.setHasWhizbang(hasWhizbang)) { updated = true; } if (cc.setIsReachable(true)) { updated = true; } break; } } } if (updated) { BroadcastUpdateNotification(); } else if (useUnitIdAsKey) { // retry matching on IP address if no cc matched UnitID update(info, deviceIpAddress, port, false); } }
From source file:at.jclehner.rxdroid.SplashScreenActivity.java
@SuppressWarnings("deprecation") @Override/*from ww w . j a v a2s . c o m*/ protected void onPrepareDialog(int id, Dialog dialog, Bundle args) { if (id == R.id.db_error_dialog) { // final WrappedCheckedException exception = mException = (WrappedCheckedException) args.getSerializable(ARG_EXCEPTION); final StringBuilder sb = new StringBuilder(); if (mException.getCauseType() == DatabaseError.class) { switch (((DatabaseError) mException.getCause()).getType()) { case DatabaseError.E_GENERAL: sb.append(getString(R.string._msg_db_error_general)); break; case DatabaseError.E_UPGRADE: sb.append(getString(R.string._msg_db_error_upgrade)); break; case DatabaseError.E_DOWNGRADE: sb.append(getString(R.string._msg_db_error_downgrade)); break; } } else sb.append(getString(R.string._msg_db_error_general)); sb.append(" " + getString(R.string._msg_db_error_footer, getString(R.string._btn_reset))); ((AlertDialog) dialog).setMessage(sb); } else super.onPrepareDialog(id, dialog, args); }