List of usage examples for android.os Bundle getParcelable
@Nullable public <T extends Parcelable> T getParcelable(@Nullable String key)
From source file:app.com.oz_heng.android.sunshine.DetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Bundle arguments = getArguments(); if (arguments != null) { mUri = arguments.getParcelable(DETAIL_URI); }//www . j a va 2 s.co m View rootView = inflater.inflate(R.layout.fragment_detail, container, false); mIconView = (ImageView) rootView.findViewById(R.id.detail_icon); mDateView = (TextView) rootView.findViewById(R.id.detail_date_textview); mFriendlyDateView = (TextView) rootView.findViewById(R.id.detail_day_textview); mDescriptionView = (TextView) rootView.findViewById(R.id.detail_forecast_textview); mHighTempView = (TextView) rootView.findViewById(R.id.detail_high_textview); mLowTempView = (TextView) rootView.findViewById(R.id.detail_low_textview); mHumidityView = (TextView) rootView.findViewById(R.id.detail_humidity_textview); mWindView = (TextView) rootView.findViewById(R.id.detail_wind_textview); mPressureView = (TextView) rootView.findViewById(R.id.detail_pressure_textview); return rootView; }
From source file:br.com.dgimenes.sunshine.DetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Bundle arguments = getArguments(); if (arguments != null) { mUri = arguments.getParcelable(DetailFragment.DETAIL_URI); }/*from ww w. j a va 2 s . c om*/ View rootView = inflater.inflate(R.layout.fragment_detail, container, false); mIconView = (ImageView) rootView.findViewById(R.id.forecast_icon); mDateView = (TextView) rootView.findViewById(R.id.date_view); mFriendlyDateView = (TextView) rootView.findViewById(R.id.friendly_date_view); mDescriptionView = (TextView) rootView.findViewById(R.id.forecast_view); mHighTempView = (TextView) rootView.findViewById(R.id.max_temp_view); mLowTempView = (TextView) rootView.findViewById(R.id.min_temp_view); mHumidityView = (TextView) rootView.findViewById(R.id.humidity_view); mWindView = (TextView) rootView.findViewById(R.id.wind_view); mPressureView = (TextView) rootView.findViewById(R.id.pressure_view); return rootView; }
From source file:com.actinarium.kinetic.ui.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState != null) { mAccelData = savedInstanceState.getParcelable(ARG_ACCEL); mGyroData = savedInstanceState.getParcelable(ARG_GYRO); mRotVectorData = savedInstanceState.getParcelable(ARG_RV); mResultHoldersState = savedInstanceState.getBooleanArray(ARG_RHS); mHolderToAnimatorMap = savedInstanceState.getIntArray(ARG_HAM); return;// w ww . ja va 2 s . co m } else { mResultHoldersState = new boolean[] { true, true, true, true, true, true }; mHolderToAnimatorMap = new int[] { PreviewHolder.ANIMATOR_X, PreviewHolder.ANIMATOR_Y, PreviewHolder.NO_ANIMATOR, PreviewHolder.NO_ANIMATOR, PreviewHolder.NO_ANIMATOR, PreviewHolder.ANIMATOR_ROTATION, }; } getSupportFragmentManager().beginTransaction() .add(R.id.root_container, new RecordFragment(), RecordFragment.TAG).commit(); }
From source file:com.ashokslsk.ashu_sunshine.DetailFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { Bundle arguments = getArguments(); if (arguments != null) { mUri = arguments.getParcelable(DetailFragment.DETAIL_URI); }//from w w w . ja v a 2 s . c o m View rootView = inflater.inflate(R.layout.fragment_detail, container, false); mIconView = (ImageView) rootView.findViewById(R.id.detail_icon); mDateView = (TextView) rootView.findViewById(R.id.detail_date_textview); mFriendlyDateView = (TextView) rootView.findViewById(R.id.detail_day_textview); mDescriptionView = (TextView) rootView.findViewById(R.id.detail_forecast_textview); mHighTempView = (TextView) rootView.findViewById(R.id.detail_high_textview); mLowTempView = (TextView) rootView.findViewById(R.id.detail_low_textview); mHumidityView = (TextView) rootView.findViewById(R.id.detail_humidity_textview); mWindView = (TextView) rootView.findViewById(R.id.detail_wind_textview); mPressureView = (TextView) rootView.findViewById(R.id.detail_pressure_textview); return rootView; }
From source file:aws.apps.usbDeviceEnumerator.ui.usbinfo.UsbInfoActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.act_usb_info); getSupportActionBar().setDisplayHomeAsUpEnabled(true); final Bundle b = getIntent().getExtras(); if (b == null) { finish();/*w w w .jav a 2 s .co m*/ } else { final String androidKey = b.getString(EXTRA_DATA_ANDROID); final SysBusUsbDevice linuxDevice = b.getParcelable(EXTRA_DATA_LINUX); final Fragment fragment; if (androidKey != null) { fragment = InfoFragmentFactory.getFragment(androidKey); } else if (linuxDevice != null) { fragment = InfoFragmentFactory.getFragment(linuxDevice); } else { fragment = null; } if (fragment == null) { finish(); } else { showFragment(fragment); } } }
From source file:com.airflo.FlightListActivity.java
/** * Method needed to restore scroll position */// w w w . j ava 2s . c o m @Override protected void onRestoreInstanceState(Bundle state) { super.onRestoreInstanceState(state); savedListState = state.getParcelable(LIST_STATE); }
From source file:fr.cph.stock.android.activity.ChartActivity.java
@SuppressLint("SetJavaScriptEnabled") @Override//from www . j av a 2 s.c om protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.chart_activity); Bundle b = getIntent().getExtras(); portfolio = b.getParcelable("portfolio"); chartType = ChartType.getEnum(b.getString("chartType")); errorView = (TextView) findViewById(R.id.errorMessage); actionBar = getActionBar(); webView = (WebView) findViewById(R.id.webView); String data = getData(); webView.setWebChromeClient(new DebugWebChromeClient()); WebSettings webSettings = webView.getSettings(); webSettings.setJavaScriptEnabled(true); // myWebView.setBackgroundColor(0x00000000); // myWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null); webView.loadDataWithBaseURL("file:///android_asset/www/", data, "text/html", "UTF-8", null); webView.reload(); // Set context EasyTracker.getInstance().setContext(getApplicationContext()); // Instantiate the Tracker tracker = EasyTracker.getTracker(); }
From source file:geert.stef.sm.beheerautokm.AddRitActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_rit); getSupportActionBar().setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.darkblue))); Bundle b = getIntent().getExtras(); manager = b.getParcelable("parcel"); selectedCar = b.getParcelable("car"); txtKMStand = (TextView) findViewById(R.id.txtKMStandValue); txtKMTank = (TextView) findViewById(R.id.txtKMTankValue); txtKMNog = (TextView) findViewById(R.id.txtKMToDriveValue); txtKMBegin = (EditText) findViewById(R.id.txtDistanceBegin); txtKMEind = (EditText) findViewById(R.id.txtDistanceEnd); txtKMTotaal = (EditText) findViewById(R.id.txtDistance); spinner = (Spinner) findViewById(R.id.spinner_cars); carSpinner = new String[manager.getCars().size()]; for (int i = 0; i < manager.getCars().size(); i++) { carSpinner[i] = manager.getCars().get(i).getCar(); }//from ww w .j a va 2 s . c o m myAdapter = new SpinAdapter(this, R.layout.spinner_row, manager.getCars()); spinner.setAdapter(myAdapter); //spinner.setSelection(myAdapter.getPosition(selectedCar), true); spinner.setSelection(((SpinAdapter) spinner.getAdapter()).getPosition(selectedCar)); spinner.setOnItemSelectedListener(this); //spinner.setSelection(myAdapter.getPosition(selectedCar), true); //spinner.setSelection(manager.getCars().get(3)); //spinner.setSelection(0, true); }
From source file:org.ohmage.auth.AuthenticatorTest.java
private void verifyNotifyUserBundle(Bundle bundle) { Intent intent = bundle.getParcelable(AccountManager.KEY_INTENT); assertNotNull(intent);/*from ww w. ja v a 2s . com*/ assertEquals(intent.getComponent().getClassName(), AuthenticatorActivity.class.getName()); assertTrue(intent.getBooleanExtra(AuthenticatorActivity.EXTRA_FROM_AUTHENTICATOR, false)); }
From source file:com.linkedin.android.eventsapp.ProfileActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile); Bundle extras = getIntent() != null ? getIntent().getExtras() : new Bundle(); final Person person = extras.getParcelable("person"); final Activity currentActivity = this; final ActionBar bar = getActionBar(); View viewActionBar = getLayoutInflater().inflate(R.layout.layout_action_bar, null); ImageView backView = (ImageView) viewActionBar.findViewById(R.id.actionbar_left); backView.setImageResource(R.drawable.arrow_left); backView.setVisibility(View.VISIBLE); backView.setClickable(true);//from w w w . ja v a 2s. c o m backView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { currentActivity.finish(); } }); ActionBar.LayoutParams params = new ActionBar.LayoutParams(ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.MATCH_PARENT); bar.setCustomView(viewActionBar, params); bar.setDisplayShowCustomEnabled(true); bar.setDisplayShowTitleEnabled(false); bar.setIcon(new ColorDrawable(Color.TRANSPARENT)); bar.setBackgroundDrawable(new ColorDrawable(Color.parseColor("#F15153"))); TextView attendeeNameView = (TextView) findViewById(R.id.attendeeName); attendeeNameView.setText(person.getFirstName() + " " + person.getLastName()); final ImageView attendeeImageView = (ImageView) findViewById(R.id.attendeeImage); final TextView attendeeHeadlineView = (TextView) findViewById(R.id.attendeeHeadline); final TextView attendeeLocationView = (TextView) findViewById(R.id.attendeeLocation); boolean isAccessTokenValid = LISessionManager.getInstance(currentActivity).getSession().isValid(); if (isAccessTokenValid) { String url = Constants.personByIdBaseUrl + person.getLinkedinId() + Constants.personProjection; APIHelper.getInstance(currentActivity).getRequest(currentActivity, url, new ApiListener() { @Override public void onApiSuccess(ApiResponse apiResponse) { try { JSONObject s = apiResponse.getResponseDataAsJson(); String headline = s.has("headline") ? s.getString("headline") : ""; String pictureUrl = s.has("pictureUrl") ? s.getString("pictureUrl") : null; JSONObject location = s.getJSONObject("location"); String locationName = location != null && location.has("name") ? location.getString("name") : ""; attendeeHeadlineView.setText(headline); attendeeLocationView.setText(locationName); if (pictureUrl != null) { new FetchImageTask(attendeeImageView).execute(pictureUrl); } else { attendeeImageView.setImageResource(R.drawable.ghost_person); } } catch (JSONException e) { } } @Override public void onApiError(LIApiError apiError) { } }); ViewStub viewOnLIStub = (ViewStub) findViewById(R.id.viewOnLIStub); View viewOnLI = viewOnLIStub.inflate(); Button viewOnLIButton = (Button) viewOnLI.findViewById(R.id.viewOnLinkedInButton); viewOnLIButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { DeepLinkHelper.getInstance().openOtherProfile(currentActivity, person.getLinkedinId(), new DeepLinkListener() { @Override public void onDeepLinkSuccess() { } @Override public void onDeepLinkError(LIDeepLinkError error) { } }); } }); } else { attendeeImageView.setImageResource(R.drawable.ghost_person); } }