List of usage examples for android.os Bundle putInt
public void putInt(@Nullable String key, int value)
From source file:com.hybris.mobile.app.commerce.fragment.CheckoutFragmentBase.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putInt(SAVED_INSTANCE_DELIVERY_METHOD, mDeliveryMethodSpinner.getSelectedItemPosition()); outState.putInt(SAVED_INSTANCE_DELIVERY_ADDRESS, mDeliveryAddressSpinner.getSelectedItemPosition()); super.onSaveInstanceState(outState); }
From source file:com.facebook.LegacyTokenCacheTest.java
@Test public void testMultipleCaches() { Bundle bundle1 = new Bundle(), bundle2 = new Bundle(); bundle1.putInt(INT_KEY, 10); bundle1.putString(STRING_KEY, "ABC"); bundle2.putInt(INT_KEY, 100);/*from w w w. j av a 2 s. c om*/ bundle2.putString(STRING_KEY, "xyz"); ensureApplicationContext(); LegacyTokenHelper cache1 = new LegacyTokenHelper(RuntimeEnvironment.application); LegacyTokenHelper cache2 = new LegacyTokenHelper(RuntimeEnvironment.application, "CustomCache"); cache1.save(bundle1); cache2.save(bundle2); // Get new references to make sure we are getting persisted data. // Reverse the cache references for fun. cache1 = new LegacyTokenHelper(RuntimeEnvironment.application, "CustomCache"); cache2 = new LegacyTokenHelper(RuntimeEnvironment.application); Bundle newBundle1 = cache1.load(), newBundle2 = cache2.load(); assertEquals(bundle2.getInt(INT_KEY), newBundle1.getInt(INT_KEY)); assertEquals(bundle2.getString(STRING_KEY), newBundle1.getString(STRING_KEY)); assertEquals(bundle1.getInt(INT_KEY), newBundle2.getInt(INT_KEY)); assertEquals(bundle1.getString(STRING_KEY), newBundle2.getString(STRING_KEY)); }
From source file:net.networksaremadeofstring.rhybudd.ZenossWidgetGraph.java
private void Refresh() { CritCount = 0;//from w w w . j a va 2 s . c om ErrCount = 0; WarnCount = 0; ((Thread) new Thread() { public void run() { try { //tempZenossEvents = rhybuddCache.GetRhybuddEvents(); RhybuddDataSource datasource = new RhybuddDataSource(wContext); datasource.open(); tempZenossEvents = datasource.GetRhybuddEvents(); datasource.close(); } catch (Exception e) { e.printStackTrace(); //tempZenossEvents.clear(); tempZenossEvents = null; } if (null != tempZenossEvents) { //Log.i("CountWidget","Found DB Data!"); handler.sendEmptyMessage(1); } /*else { //Log.i("CountWidget","No DB data found, querying API directly"); //handler.sendEmptyMessage(2); try { if(API == null) { if(settings.getBoolean("httpBasicAuth", false)) { API = new ZenossAPIv2(settings.getString("userName", ""), settings.getString("passWord", ""), settings.getString("URL", ""),settings.getString("BAUser", ""), settings.getString("BAPassword", "")); } else { API = new ZenossAPIv2(settings.getString("userName", ""), settings.getString("passWord", ""), settings.getString("URL", "")); } } try { if(API != null) { tempZenossEvents = API.GetRhybuddEvents(true, true, true, false, false, true, null, null); } else { tempZenossEvents = null; handler.sendEmptyMessage(999); } } catch(Exception e) { handler.sendEmptyMessage(999); } } catch(Exception e) { e.printStackTrace(); } }*/ if (tempZenossEvents != null) { EventCount = tempZenossEvents.size(); for (int i = 0; i < EventCount; i++) { if (tempZenossEvents.get(i).getSeverity().equals("5")) CritCount++; if (tempZenossEvents.get(i).getSeverity().equals("4")) ErrCount++; if (tempZenossEvents.get(i).getSeverity().equals("3")) WarnCount++; } tempZenossEvents = null; API = null; } //No matter what send an update //handler.sendEmptyMessage(0); Message Msg = new Message(); Bundle data = new Bundle(); data.putInt("CritCount", CritCount); data.putInt("ErrCount", ErrCount); data.putInt("WarnCount", WarnCount); Msg.setData(data); Msg.what = 1; handler.sendMessage(Msg); } }).start(); }
From source file:com.brodev.socialapp.view.ImagePagerActivity.java
@Override public void onSaveInstanceState(Bundle outState) { outState.putInt(STATE_POSITION, pager.getCurrentItem()); }
From source file:rpi.rpiface.VoteActivity.java
/** * Guarda el recuento de votos en los cambios de estado. * /* w w w . j a v a 2s. c om*/ * @param outState * Estructura donde se guardarn los valores. */ @Override protected void onSaveInstanceState(Bundle outState) { outState.putInt(VOTE_STATE_PLUS, plus); outState.putInt(VOTE_STATE_MINUS, minus); }
From source file:app.hacked.MainActivity.java
@Override public void onProjectItemSelected(Project project) { if (findViewById(R.id.ProjectDetails) != null) { mTwoPane = true;/*from w ww . j a v a 2 s . c o m*/ Bundle arguments = new Bundle(); arguments.putInt(ProjectDetailsFragment.PROJECTID, project.ID); arguments.putString(ProjectDetailsFragment.NAME, project.Name); arguments.putString(ProjectDetailsFragment.SYNOPSIS, project.Synopsis); arguments.putString(ProjectDetailsFragment.DESCRIPTION, project.Description); arguments.putString(ProjectDetailsFragment.LOCATION, project.Location); arguments.putString(ProjectDetailsFragment.TECHNOLOGIES, project.Technologies); arguments.putInt(ProjectDetailsFragment.POPULARITY, project.Popularity); //arguments.putString(ProjectDetailsFragment.TEAMMEMBERS, project.getTeamMembers()); arguments.putBoolean(ProjectDetailsFragment.ARG_2PANE, true); arguments.putParcelableArrayList(ProjectDetailsFragment.TEAMMEMBERS, project.TeamMembers); ProjectDetailsFragment fragment = new ProjectDetailsFragment(); fragment.setArguments(arguments); fragment.setHasOptionsMenu(true); getSupportFragmentManager().beginTransaction().replace(R.id.ProjectDetails, fragment).commit(); } else { mTwoPane = false; Intent detailIntent = new Intent(this, ProjectDetailsActivity.class); detailIntent.putExtra(ProjectDetailsFragment.PROJECTID, project.ID); detailIntent.putExtra(ProjectDetailsFragment.NAME, project.Name); detailIntent.putExtra(ProjectDetailsFragment.SYNOPSIS, project.Synopsis); detailIntent.putExtra(ProjectDetailsFragment.DESCRIPTION, project.Description); detailIntent.putExtra(ProjectDetailsFragment.LOCATION, project.Location); detailIntent.putExtra(ProjectDetailsFragment.TECHNOLOGIES, project.Technologies); detailIntent.putExtra(ProjectDetailsFragment.POPULARITY, project.Popularity); //detailIntent.putExtra(ProjectDetailsFragment.TEAMMEMBERS, project.getTeamMembers()); detailIntent.putParcelableArrayListExtra(ProjectDetailsFragment.TEAMMEMBERS, project.TeamMembers); detailIntent.putExtra(ProjectDetailsFragment.ARG_2PANE, false); startActivity(detailIntent); } }
From source file:com.brodev.socialapp.view.MusicPlaySong.java
/** Called when the activity is first created. */ @Override//from w ww . jav a2s .c om public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.music_player); if (android.os.Build.VERSION.SDK_INT > 9) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } getSupportActionBar().setDisplayHomeAsUpEnabled(true); user = (User) getApplication().getApplicationContext(); colorView = new ColorView(getApplicationContext()); Bundle bundle = getIntent().getExtras(); music = (Music) bundle.get("song"); if (music.getTitle().equals("")) { this.getMusicAdapter(); } initView(); // get comment fragment Bundle comment = new Bundle(); comment.putString("type", "music_song"); comment.putInt("itemId", Integer.parseInt(music.getSong_id())); comment.putInt("totalComment", Integer.parseInt(music.getTotal_comment())); comment.putInt("total_like", Integer.parseInt(music.getTotal_like())); comment.putBoolean("no_share", music.isShare()); comment.putBoolean("is_liked", music.isLiked()); comment.putBoolean("can_post_comment", music.isCanPostComment()); CommentFragment commentFragment = new CommentFragment(); commentFragment.setArguments(comment); getSupportFragmentManager().beginTransaction().add(R.id.commentfragment_wrap, commentFragment).commit(); }
From source file:fr.cph.chicago.core.activity.BusMapActivity.java
@Override public void onSaveInstanceState(final Bundle savedInstanceState) { savedInstanceState.putInt(bundleBusId, busId); savedInstanceState.putString(bundleBusRouteId, busRouteId); savedInstanceState.putStringArray(bundleBusBounds, bounds); super.onSaveInstanceState(savedInstanceState); }
From source file:org.ale.scanner.zotero.web.zotero.ZoteroAPIClient.java
public void getPermissions() { // https://apis.zotero.org/users/<userid>/keys/<apikey> APIRequest r = newRequest();/*from w ww. j av a2s.co m*/ r.setHttpMethod(APIRequest.GET); r.setURI(buildURI(null, mAccount.getUid(), "keys", mAccount.getKey())); Bundle extra = new Bundle(); extra.putInt(EXTRA_REQ_TYPE, ZoteroAPIClient.PERMISSIONS); r.setExtra(extra); mRequestQueue.enqueue(r); }
From source file:org.ale.scanner.zotero.web.zotero.ZoteroAPIClient.java
public void getGroups() { // https://apis.zotero.org/users/<userid>/groups APIRequest r = newRequest();/* w w w. j av a 2 s . c om*/ r.setHttpMethod(APIRequest.GET); r.setURI(buildURI(null, mAccount.getUid(), "groups")); Bundle extra = new Bundle(); extra.putInt(EXTRA_REQ_TYPE, ZoteroAPIClient.GROUPS); r.setExtra(extra); mRequestQueue.enqueue(r); }