List of usage examples for android.os Bundle putInt
public void putInt(@Nullable String key, int value)
From source file:net.eledge.android.europeana.gui.activity.SearchActivity.java
private void saveProfile() { if (!searchController.hasFacetsSelected()) { GuiUtils.toast(this, R.string.msg_profile_selectfacets); return;//from w ww . ja v a2s . co m } Bundle bundle = new Bundle(); bundle.putInt(NameInputDialog.KEY_RESTITLE_INT, R.string.dialog_profile_saveas_title); bundle.putInt(NameInputDialog.KEY_RESTEXT_INT, R.string.dialog_profile_saveas_text); bundle.putInt(NameInputDialog.KEY_RESINPUT_INT, R.string.dialog_profile_saveas_title); bundle.putInt(NameInputDialog.KEY_RESPOSBUTTON_INT, R.string.action_save_profile); NameInputDialog dialog = new NameInputDialog(); dialog.setArguments(bundle); dialog.show(getSupportFragmentManager(), "SaveAs"); }
From source file:com.bczm.widgetcollections.player.MusicPlayer.java
private void sendPlayBundle() { Intent intent = new Intent(Constants.ACTION_MUSIC_BUNDLE_BROADCAST); Bundle extras = new Bundle(); LogUtils.e("sendPlayBundle-------------------------------->" + getDuration()); extras.putInt(Constants.KEY_MUSIC_TOTAL_DURATION, getDuration()); extras.putParcelable(Constants.KEY_MUSIC_PARCELABLE_DATA, mMusicList.get(mCurPlayIndex)); intent.putExtras(extras);//from w ww.j a va2 s . c o m mContext.sendBroadcast(intent); }
From source file:com.shanet.relayremote.Main.java
public void getRelayStates() { Toast.makeText(this, R.string.refreshingRelays, Toast.LENGTH_SHORT).show(); // If no relays exist, call the set relays function directly so // the list adapters in the fragments are still created if (relays.size() == 0) { setRelaysAndGroupsStates(null);//w ww. j av a 2 s .co m } // For each unique server, start a thread to get the state of the relays on that server ArrayList<String> servers = new ArrayList<String>(); Relay relay; for (int i = 0; i < relays.size(); i++) { relay = relays.get(i); if (!servers.contains(relay.getServer())) { Bundle bgInfo = new Bundle(); bgInfo.putChar("op", Constants.OP_GET); bgInfo.putString("server", relay.getServer()); bgInfo.putInt("port", relay.getPort()); // Add this server to the server list so we don't check it again servers.add(relay.getServer()); new Background(this, Constants.OP_GET, false).execute(bgInfo); } } }
From source file:org.dvbviewer.controller.ui.fragments.StreamConfig.java
@Override public void onSaveInstanceState(Bundle bundle) { super.onSaveInstanceState(bundle); bundle.putInt("titleRes", title); }
From source file:org.ale.scanner.zotero.web.zotero.ZoteroAPIClient.java
public void newCollection(String name, String parent) { // https://apis.zotero.org/users/<userid>/collections JSONObject collection = new JSONObject(); try {/*ww w . j a v a2s . c o m*/ collection.put("name", name); collection.put("parent", parent); APIRequest r = newRequest(); r.setHttpMethod(APIRequest.POST); r.setURI(buildURI(null, mAccount.getUid(), "collections")); r.setContent(collection.toString(), "application/json"); r.addHeader(HDR_WRITE_TOKEN, newWriteToken()); Bundle extra = new Bundle(); extra.putInt(EXTRA_REQ_TYPE, ZoteroAPIClient.COLLECTIONS); r.setExtra(extra); mRequestQueue.enqueue(r); } catch (JSONException e) { e.printStackTrace(); } }
From source file:jp.sonymusicstudio.cast.castcompanionlibrary.utils.Utils.java
/** * Builds and returns a {@link Bundle} which contains a select subset of data in the * {@link MediaInfo}. Since {@link MediaInfo} is not {@link Parcelable}, one can use this * container bundle to pass around from one activity to another. * * @see <code>bundleToMediaInfo()</code> *///ww w. j av a 2 s. c om public static Bundle mediaInfoToBundle(MediaInfo info) { if (info == null) { return null; } MediaMetadata md = info.getMetadata(); Bundle wrapper = new Bundle(); wrapper.putString(MediaMetadata.KEY_TITLE, md.getString(MediaMetadata.KEY_TITLE)); wrapper.putString(MediaMetadata.KEY_SUBTITLE, md.getString(MediaMetadata.KEY_SUBTITLE)); wrapper.putString(MediaMetadata.KEY_ALBUM_TITLE, md.getString(MediaMetadata.KEY_ALBUM_TITLE)); wrapper.putString(MediaMetadata.KEY_ALBUM_ARTIST, md.getString(MediaMetadata.KEY_ALBUM_ARTIST)); wrapper.putString(MediaMetadata.KEY_COMPOSER, md.getString(MediaMetadata.KEY_COMPOSER)); wrapper.putString(MediaMetadata.KEY_SERIES_TITLE, md.getString(MediaMetadata.KEY_SERIES_TITLE)); wrapper.putString(MediaMetadata.KEY_SEASON_NUMBER, md.getString(MediaMetadata.KEY_SEASON_NUMBER)); wrapper.putString(MediaMetadata.KEY_EPISODE_NUMBER, md.getString(MediaMetadata.KEY_EPISODE_NUMBER)); Calendar releaseCalender = md.getDate(MediaMetadata.KEY_RELEASE_DATE); if (releaseCalender != null) { long releaseMillis = releaseCalender.getTimeInMillis(); wrapper.putLong(MediaMetadata.KEY_RELEASE_DATE, releaseMillis); } wrapper.putInt(KEY_MEDIA_TYPE, info.getMetadata().getMediaType()); wrapper.putString(KEY_URL, info.getContentId()); wrapper.putString(MediaMetadata.KEY_STUDIO, md.getString(MediaMetadata.KEY_STUDIO)); wrapper.putString(KEY_CONTENT_TYPE, info.getContentType()); wrapper.putInt(KEY_STREAM_TYPE, info.getStreamType()); wrapper.putLong(KEY_STREAM_DURATION, info.getStreamDuration()); if (!md.getImages().isEmpty()) { ArrayList<String> urls = new ArrayList<>(); for (WebImage img : md.getImages()) { urls.add(img.getUrl().toString()); } wrapper.putStringArrayList(KEY_IMAGES, urls); } JSONObject customData = info.getCustomData(); if (customData != null) { wrapper.putString(KEY_CUSTOM_DATA, customData.toString()); } if (info.getMediaTracks() != null && !info.getMediaTracks().isEmpty()) { try { JSONArray jsonArray = new JSONArray(); for (MediaTrack mt : info.getMediaTracks()) { JSONObject jsonObject = new JSONObject(); jsonObject.put(KEY_TRACK_NAME, mt.getName()); jsonObject.put(KEY_TRACK_CONTENT_ID, mt.getContentId()); jsonObject.put(KEY_TRACK_ID, mt.getId()); jsonObject.put(KEY_TRACK_LANGUAGE, mt.getLanguage()); jsonObject.put(KEY_TRACK_TYPE, mt.getType()); if (mt.getSubtype() != MediaTrack.SUBTYPE_UNKNOWN) { jsonObject.put(KEY_TRACK_SUBTYPE, mt.getSubtype()); } if (mt.getCustomData() != null) { jsonObject.put(KEY_TRACK_CUSTOM_DATA, mt.getCustomData().toString()); } jsonArray.put(jsonObject); } wrapper.putString(KEY_TRACKS_DATA, jsonArray.toString()); } catch (JSONException e) { LOGE(TAG, "mediaInfoToBundle(): Failed to convert Tracks data to json", e); } } return wrapper; }
From source file:com.group7.dragonwars.MapSelectActivity.java
@Override public final void onItemClick(final AdapterView<?> parent, final View v, final int position, final long id) { if (position < mapInfo.size()) { Intent intent = new Intent(this, PlayerSelectActivity.class); Bundle b = new Bundle(); b.putString("mapFileName", mapInfo.get(position).getPath()); b.putString("mapName", mapInfo.get(position).getName()); int numPlayers = mapInfo.get(position).getPlayers(); b.putBooleanArray("isAi", new boolean[numPlayers]); // boolean defaults to false, what could possibly go wrong? b.putInt("numPlayers", numPlayers); /* Make a fake player list for now, again */ String[] playerNames = new String[numPlayers]; for (Integer i = 0; i < numPlayers; ++i) { playerNames[i] = ("Player " + (i + 1)); }/*from w ww.j a v a2 s .c o m*/ b.putStringArray("playerNames", playerNames); intent.putExtras(b); startActivity(intent); } }
From source file:com.gaze.webpaser.StackWidgetService.java
public RemoteViews getViewAt(int position) { Log.i(LOG_TAG, "getViewAt " + position); // position will always range from 0 to getCount() - 1. // We construct a remote views item based on our widget item xml file, // and set the // text based on the position. RemoteViews rv = new RemoteViews(mContext.getPackageName(), R.layout.item_widget); rv.setTextViewText(R.id.textView_title, mlist.get(position).getTitle()); String time = Util.getFormatTime(mlist.get(position).getTime()); rv.setTextViewText(R.id.textView3_time, time); // Next, we set a fill-intent which will be used to fill-in the pending // intent template // which is set on the collection view in StackWidgetProvider. Bundle extras = new Bundle(); extras.putInt(StackWidgetProvider.EXTRA_ITEM, position); Intent fillInIntent = new Intent(); fillInIntent.putExtras(extras);//from w w w . ja v a 2 s . c o m rv.setOnClickFillInIntent(R.id.widget1, fillInIntent); // You can do heaving lifting in here, synchronously. For example, if // you need to // process an image, fetch something from the network, etc., it is ok to // do it here, // synchronously. A loading view will show up in lieu of the actual // contents in the // interim. // try { // System.out.println("Loading view " + position); // Thread.sleep(500); // } catch (InterruptedException e) { // e.printStackTrace(); // } Bitmap bitmap = getBitmap(GlobalData.baseUrl + mlist.get(position).getImagePath()); if (bitmap != null) rv.setImageViewBitmap(R.id.imageView1, bitmap); // Return the remote views object. return rv; }
From source file:com.lepin.activity.PincheTrailActivity.java
@Override public void onClick(View view) { if (this.mTitleBack == view) {// PincheTrailActivity.this.finish(); } else if (this.mappointment == view) {// ? if (util.isUserLoging(PincheTrailActivity.this)) { // ?? getBook();/*w w w . j a va2s . com*/ } else {// ? util.go2Activity(PincheTrailActivity.this, LoginActivity.class); } } else if (this.mPhotoView == view) { // ??? // ? // if (util.isUserLoging(PincheTrailActivity.this)) { // ? if (util.getLoginUser(PincheTrailActivity.this) != null && mPincheDetails.getUser_id() == util.getLoginUser(PincheTrailActivity.this).getUserId()) { // util.go2Activity(PincheTrailActivity.this, PersonalInfoActivity.class); } else { int userId = mPincheDetails.getUser().getUserId(); Bundle dataBundle = new Bundle(); dataBundle.putInt("userId", userId); dataBundle.putString("role", role); util.go2ActivityWithBundle(PincheTrailActivity.this, PersonalInfoTrailActivity.class, dataBundle); } } else { // ? Util.getInstance().go2Activity(PincheTrailActivity.this, LoginActivity.class); } } else if (view == mapImageView) { if (null == mPincheDetails.getStartLat() || null == mPincheDetails.getStartLon() || null == mPincheDetails.getEndLat() || null == mPincheDetails.getEndLon()) { Util.showToast(PincheTrailActivity.this, getResources().getString(R.string.pinche_trail_no_location)); } else { Util.getInstance().showStartAndEndOnMap(PincheTrailActivity.this, mPincheDetails); } } }
From source file:com.makerfaireorlando.app.MainActivity.java
public void onEventSelected(int p) { EventDetailFragment newFragment = new EventDetailFragment(); Bundle args = new Bundle(); args.putInt("Position", p); newFragment.setArguments(args);// w w w .j av a 2 s . c o m FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); // Replace whatever is in the fragment_container view with this fragment, // and add the transaction to the back stack so the user can navigate back transaction.replace(R.id.content_frame, newFragment).setCustomAnimations(android.R.anim.slide_in_left, 0, 0, android.R.anim.slide_out_right); transaction.addToBackStack(null); mDrawerToggle.setDrawerIndicatorEnabled(false); getSupportActionBar().setDisplayHomeAsUpEnabled(true); // Commit the transaction transaction.commit(); }