List of usage examples for android.os Bundle putInt
public void putInt(@Nullable String key, int value)
From source file:com.aleiacampo.oristanobus.util.ViewUtil.java
public static void loadMostSearched(final AppCompatActivity appCompatActivity) { final ArrayList<Stop> stopsList = new ArrayList<>(); final ArrayList<String> stopsNameList = new ArrayList<>(); new AsyncTask<Void, Void, Void>() { @Override/*w w w. j a v a 2 s . c o m*/ protected void onPreExecute() { super.onPreExecute(); if (!ConnectionsHandler.isNetworkPresent(appCompatActivity)) { this.cancel(true); stopsNameList.add("Connessione dati non presente"); ListView listView_searched = (ListView) appCompatActivity .findViewById(R.id.textView_mostSerched); ArrayAdapter<String> adapter = new ArrayAdapter<>(appCompatActivity.getApplicationContext(), R.layout.text_view, stopsNameList); listView_searched.setAdapter(adapter); } } @Override protected Void doInBackground(Void... params) { Stop stop; String url = "http://www.aleiacampo.com/stops.php?clicked=10"; WebServerHandler webServerHandler = new WebServerHandler(); String jsonStr = webServerHandler.getJSONData(url); try { JSONObject jsonObject = new JSONObject(jsonStr); JSONArray stopsJSON = jsonObject.getJSONArray("bus_stops"); for (int i = 0; i < stopsJSON.length(); i++) { JSONObject bus_stop = stopsJSON.getJSONObject(i); stop = new Stop(bus_stop.getInt("id_line"), bus_stop.getInt("id_stop"), bus_stop.getString("name_line"), bus_stop.getString("name_stop")); stopsList.add(stop); } } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); for (Stop stop : stopsList) { stopsNameList.add("Linea " + stop.idLine + " - " + stop.nameStop); } ListView listView_searched = (ListView) appCompatActivity.findViewById(R.id.textView_mostSerched); ArrayAdapter<String> adapter = new ArrayAdapter<>(appCompatActivity.getApplicationContext(), R.layout.text_view, stopsNameList); listView_searched.setAdapter(adapter); listView_searched.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { Bundle bundle = new Bundle(); bundle.putInt("id_stop", stopsList.get(position).idStop); bundle.putInt("id_line", stopsList.get(position).idLine); bundle.putString("name_line", stopsList.get(position).nameLine); bundle.putString("name_stop", stopsList.get(position).nameStop); FragmentManager fragmentManager = appCompatActivity.getSupportFragmentManager(); TimesFragment timesFragment = new TimesFragment(); timesFragment.setArguments(bundle); appCompatActivity.onBackPressed(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.home_frag, timesFragment, "Times"); fragmentTransaction.addToBackStack(null); fragmentTransaction.commit(); } }); } }.execute(); }
From source file:io.v.android.apps.syncslides.DeckChooserFragment.java
/** * Returns a new instance of this fragment for the given section number. *///from w w w . j a va 2s .c o m public static DeckChooserFragment newInstance(int sectionNumber) { DeckChooserFragment fragment = new DeckChooserFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); fragment.setArguments(args); return fragment; }
From source file:it.scoppelletti.mobilepower.app.ProgressDialogFragment.java
/** * Istanzia un frammento.//from www. java 2 s. c o m * * @param titleId Identificatore della risorsa del titolo. * @param max Valore massimo dell’indice di avanzamento. Se * è minore o uguale a {@code 0}, l’indice * di avanzamento è indeterminato. * @param cancelable Indicatore di dialogo cancellabile. * @return Frammento. */ public static ProgressDialogFragment newInstance(int titleId, int max, boolean cancelable) { Bundle args; ProgressDialogFragment fragment; args = new Bundle(); args.putInt(ProgressDialogFragment.ARG_TITLEID, titleId); args.putInt(ProgressDialogFragment.ARG_MAX, max); args.putBoolean(ProgressDialogFragment.ARG_CANCELABLE, cancelable); fragment = new ProgressDialogFragment(); fragment.setArguments(args); fragment.setCancelable(cancelable); return fragment; }
From source file:com.mifos.mifosxdroid.dialogfragments.chargedialog.ChargeDialogFragment.java
public static ChargeDialogFragment newInstance(int clientId) { ChargeDialogFragment chargeDialogFragment = new ChargeDialogFragment(); Bundle args = new Bundle(); args.putInt(Constants.CLIENT_ID, clientId); chargeDialogFragment.setArguments(args); return chargeDialogFragment; }
From source file:com.mifos.mifosxdroid.dialogfragments.loanaccountdisbursement.LoanAccountDisbursement.java
public static LoanAccountDisbursement newInstance(int loanAccountNumber) { LoanAccountDisbursement loanAccountDisbursement = new LoanAccountDisbursement(); Bundle args = new Bundle(); args.putInt(Constants.LOAN_ACCOUNT_NUMBER, loanAccountNumber); loanAccountDisbursement.setArguments(args); return loanAccountDisbursement; }
From source file:com.mifos.mifosxdroid.dialogfragments.loanchargedialog.LoanChargeDialogFragment.java
public static LoanChargeDialogFragment newInstance(int loanAccountNumber) { LoanChargeDialogFragment loanChargeDialogFragment = new LoanChargeDialogFragment(); Bundle args = new Bundle(); args.putInt(Constants.LOAN_ACCOUNT_NUMBER, loanAccountNumber); loanChargeDialogFragment.setArguments(args); return loanChargeDialogFragment; }
From source file:com.mikecorrigan.trainscorekeeper.FragmentSummary.java
public static FragmentSummary newInstance(int index, JSONObject jsonSpec) { Log.vc(VERBOSE, TAG, "newInstance: jsonTab=" + jsonSpec); FragmentSummary fragment = new FragmentSummary(); Bundle args = new Bundle(); args.putInt(ARG_INDEX, index); args.putString(ARG_TAB_SPEC, jsonSpec.toString()); fragment.setArguments(args);/*from www . j ava 2 s .c o m*/ return fragment; }
From source file:net.sf.sprockets.app.ui.SprocketsPreferenceFragment.java
/** * Display the preferences and send changes to analytics. * * @param trackChanges if true, {@link Trackers#use(Context, Tracker) Trackers.use} must have * already been called * @since 2.6.0// www . j a va2s .c o m */ public static SprocketsPreferenceFragment newInstance(int prefsResId, boolean trackChanges) { SprocketsPreferenceFragment frag = new SprocketsPreferenceFragment(); Bundle args = Fragments.arguments(frag); args.putInt(PREFS, prefsResId); args.putBoolean(TRACK_CHANGES, trackChanges); return frag; }
From source file:com.mifos.mifosxdroid.online.ClientChargeFragment.java
public static ClientChargeFragment newInstance(int clientId, List<Charges> chargesList) { ClientChargeFragment fragment = new ClientChargeFragment(); Bundle args = new Bundle(); args.putInt(Constants.CLIENT_ID, clientId); fragment.setArguments(args);/* w w w .j a v a 2 s . c o m*/ if (chargesList != null) fragment.setChargesList(chargesList); return fragment; }
From source file:com.linkedin.android.eventsapp.EventFragment.java
public static final EventFragment newInstance(Event event) { EventFragment f = new EventFragment(); Bundle bdl = new Bundle(); bdl.putString(EXTRA_EVENT_NAME, event.getEventName()); bdl.putInt(EXTRA_PICTURE_ID, event.getImageResourceId()); bdl.putString(EXTRA_EVENT_LOCATION, event.getEventLocation()); bdl.putLong(EXTRA_EVENT_DATE, event.getEventDate()); bdl.putBoolean(EXTRA_EVENT_ATTENDING, event.getIsAttending()); bdl.putParcelableArray(EXTRA_EVENT_ATTENDEES, event.getEventAttendees()); f.setArguments(bdl);//from w w w.j a v a 2 s. com return f; }