List of usage examples for android.os Bundle Bundle
public Bundle()
From source file:com.example.kyle.weatherforecast.FragmentAdapter.java
@Override public Fragment getItem(int index) { Fragment fragment = new WeatherFragment(); Bundle args = new Bundle(); args.putInt("day", index); fragment.setArguments(args);/* www . j a v a 2 s . co m*/ return fragment; }
From source file:com.example.orangeweather.JSONWeatherParser.java
public static Bundle getWeather(JSONObject jObj) throws JSONException { Bundle bundle = new Bundle(); JSONObject coordObj = getObject("coord", jObj); bundle.putString(CityTags.CITY_NAME, getString("name", jObj)); bundle.putInt(CityTags.CITY_ID, getInt("id", jObj)); bundle.putInt(WeatherTags.WEATHER_DT, getInt("dt", jObj)); bundle.putString(CityTags.CITY_COORD, getDMSCoordinates(getFloat("lat", coordObj), getFloat("lon", coordObj))); JSONObject sysObj = getObject("sys", jObj); bundle.putString(CityTags.CITY_SYS_COUNTRY, getString("country", sysObj)); if (sysObj.has("sunrise")) { bundle.putInt(WeatherTags.WEATHER_SYS_SUNRISE, getInt("sunrise", sysObj)); }/*w w w . j a va2s. com*/ if (sysObj.has("sunset")) { bundle.putInt(WeatherTags.WEATHER_SYS_SUNSET, getInt("sunset", sysObj)); } JSONArray jArr = jObj.getJSONArray("weather"); JSONObject JSONWeather = jArr.getJSONObject(0); bundle.putString(WeatherTags.WEATHER_CONDITION_DESC, getString("description", JSONWeather)); bundle.putString(WeatherTags.WEATHER_CONDITION_MAIN, getString("main", JSONWeather)); JSONObject mainObj = getObject("main", jObj); bundle.putInt(WeatherTags.WEATHER_MAIN_HUMIDITY, getInt("humidity", mainObj)); bundle.putInt(WeatherTags.WEATHER_MAIN_PRESSURE, getInt("pressure", mainObj)); bundle.putString(WeatherTags.WEATHER_MAIN_TEMP_MAX, getTemperatureString(getFloat("temp_max", mainObj))); bundle.putString(WeatherTags.WEATHER_MAIN_TEMP_MIN, getTemperatureString(getFloat("temp_min", mainObj))); bundle.putString(WeatherTags.WEATHER_MAIN_TEMP, getTemperatureString(getFloat("temp", mainObj))); JSONObject wObj = getObject("wind", jObj); bundle.putFloat(WeatherTags.WEATHER_WIND_SPEED, getFloat("speed", wObj)); bundle.putInt(WeatherTags.WEATHER_WIND_DEG, getInt("deg", wObj)); if (wObj.has("var_beg")) { bundle.putInt(WeatherTags.WEATHER_WIND_VAR_BEG, getInt("var_beg", wObj)); } if (wObj.has("var_end")) { bundle.putInt(WeatherTags.WEATHER_WIND_VAR_END, getInt("var_end", wObj)); } JSONObject cObj = getObject("clouds", jObj); bundle.putInt(WeatherTags.WEATHER_CLOUDS_ALL, getInt("all", cObj)); return bundle; }
From source file:com.naman14.algovisualizer.AlgoDescriptionFragment.java
public static AlgoDescriptionFragment newInstance(String algorithm) { AlgoDescriptionFragment fragment = new AlgoDescriptionFragment(); Bundle bundle = new Bundle(); bundle.putString(Algorithm.KEY_ALGORITHM, algorithm); fragment.setArguments(bundle);/*from ww w .j a va 2s .c o m*/ return fragment; }
From source file:com.docd.purefm.ui.dialogs.PartitionInfoDialog.java
public static DialogFragment instantiate(final GenericFile file) { final Bundle args = new Bundle(); args.putSerializable(Extras.EXTRA_FILE, file); final PartitionInfoDialog d = new PartitionInfoDialog(); d.setArguments(args);/*from w ww. j av a2 s . co m*/ return d; }
From source file:gov.in.bloomington.georeporter.fragments.SavedReportViewFragment.java
public static SavedReportViewFragment newInstance(int position) { SavedReportViewFragment fragment = new SavedReportViewFragment(); Bundle args = new Bundle(); args.putInt(POSITION, position);/*from w ww .ja va2 s . com*/ fragment.setArguments(args); return fragment; }
From source file:mobisocial.musubi.ui.fragments.ChooseImageDialog.java
public static ChooseImageDialog newInstance() { Bundle args = new Bundle(); ChooseImageDialog spd = new ChooseImageDialog(); spd.setArguments(args);//from w w w. j ava 2 s. c om return spd; }
From source file:Main.java
/** * This version show the user an access request screen for the user to authorize the app * * @param accountManager//from w w w .j a va 2s .c o m * @param account * @param ota * @param activity */ public static void GetAuthTokenFromAccountManager(AccountManager accountManager, Account account, AccountManagerCallback<Bundle> ota, Activity activity) { Bundle bundle = new Bundle(); accountManager.getAuthToken(account, SCOPE, bundle, activity, ota, null); }
From source file:com.maskyn.fileeditorpro.dialogfragment.FileInfoDialog.java
public static FileInfoDialog newInstance(Uri uri) { final FileInfoDialog f = new FileInfoDialog(); final Bundle args = new Bundle(); args.putParcelable("uri", uri); f.setArguments(args);// w ww . ja v a 2 s .com return f; }
From source file:com.mikecorrigan.bohrium.pubsub.JSONCodec.java
public static Bundle fromJson(JSONObject j) { Log.v(TAG, "fromJson"); try {//from w ww .j av a 2 s . c om Bundle bundle = new Bundle(); Iterator<String> i = j.keys(); while (i.hasNext()) { final String key = i.next(); final String value = j.getString(key); Log.v(TAG, "key=" + key + ", value=" + value); bundle.putString(key, value); } return bundle; } catch (JSONException e) { Log.e(TAG, "exception=" + e); Log.e(TAG, Log.getStackTraceString(e)); } return null; }
From source file:Main.java
/** * Get application meta-data of a package name. * @param context application context.//from www . j a v a 2 s. co m * @param packageName package name to get meta-data. * @return meta-data, may be empty but never null. */ public static Bundle getMetaData(Context context, String packageName) { Bundle config; try { config = context.getPackageManager().getApplicationInfo(packageName, PackageManager.GET_META_DATA).metaData; if (config == null) config = new Bundle(); } catch (Exception e) { /* * NameNotFoundException or in some rare scenario an undocumented "RuntimeException: Package * manager has died.", probably caused by a system app process crash. */ config = new Bundle(); } return config; }