List of usage examples for android.os Bundle get
@Nullable
public Object get(String key)
From source file:com.cloudzilla.fb.FacebookServiceProxy.java
public void showFacebookDialog(final String action, final Bundle params) { Log.d(TAG, "showFacebookDialog action=" + action + " params=" + toString(params)); if (mInstance == null || !mInstance.isOnFacebook()) { Log.e(TAG, "You are not on Facebook"); return;/* ww w .ja v a2 s . c o m*/ } new AsyncTask<Void, Void, JSONObject>() { private final IFacebookService facebookService = mFacebookService; protected JSONObject doInBackground(Void... nada) { JSONObject result = null; try { JSONObject jsonRequest = new JSONObject(); jsonRequest.put("method", action); for (String key : params.keySet()) { jsonRequest.put(key, params.get(key)); } String resultAsStr = facebookService.ui(jsonRequest.toString()); if (resultAsStr != null) { result = new JSONObject(resultAsStr); } } catch (JSONException e) { Log.e(TAG, "Exception: ", e); } catch (RemoteException e) { Log.e(TAG, "Failed to invoke FacebookService", e); } return result; } protected void onPostExecute(JSONObject result) { Bundle bundle = null; if (result != null) { try { bundle = toBundle(result); } catch (JSONException e) { // Nothing to do. We'll return a Facebook // exception below. } if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Response from Facebook: "); for (String key : bundle.keySet()) { Log.d(TAG, "\t" + key + "=" + bundle.get(key)); } } // listener.onComplete(bundle, null); } else { // listener.onComplete(null, new FacebookException()); } } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }
From source file:io.v.android.apps.syncslides.PresentationActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate"); // Initialize the DeckFactory. mDeckFactory = DeckFactory.Singleton.get(getApplicationContext()); // Immediately initialize V23, possibly sending user to the // AccountManager to get blessings. V23Manager.Singleton.get().init(getApplicationContext(), this); setContentView(R.layout.activity_presentation); mShouldBeAdvertising = false;//ww w. ja va2s .com mIsAdvertising = false; String deckId; if (savedInstanceState == null) { Log.d(TAG, "savedInstanceState is null"); deckId = getIntent().getStringExtra(Deck.B.DECK_ID); mRole = (Role) getIntent().getSerializableExtra(Participant.B.PARTICIPANT_ROLE); mPresentationId = getIntent().getStringExtra(Participant.B.PRESENTATION_ID); mSyncgroupName = getIntent().getStringExtra(Participant.B.SYNCGROUP_NAME); mSynced = true; } else { Log.d(TAG, "savedInstanceState is NOT null"); mRole = (Role) savedInstanceState.get(Participant.B.PARTICIPANT_ROLE); deckId = savedInstanceState.getString(Deck.B.DECK_ID); mPresentationId = savedInstanceState.getString(Participant.B.PRESENTATION_ID); mSyncgroupName = savedInstanceState.getString(Participant.B.SYNCGROUP_NAME); mSynced = savedInstanceState.getBoolean(Participant.B.PARTICIPANT_SYNCED); mShouldBeAdvertising = savedInstanceState.getBoolean(Participant.B.PARTICIPANT_SHOULD_ADV); if (mShouldBeAdvertising) { Log.d(TAG, "Need to restore advertising"); } } // TODO(kash): This is a total hack. I thought that the deck would be // loaded by this point, but we aren't actually guaranteed that. After // this is fixed, we can uncomment handleError in SyncbaseDB.getDeck(). while ((mDeck = DB.Singleton.get(getApplicationContext()).getDeck(deckId)) == null) { Log.d(TAG, "Waiting for deck to load..."); try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } if (mDeck == null) { throw new IllegalArgumentException("Unusable deckId: " + deckId); } Log.d(TAG, "Unpacked state:"); Log.d(TAG, " mShouldBeAdvertising = " + mShouldBeAdvertising); Log.d(TAG, " mRole = " + mRole); Log.d(TAG, " mPresentationId = " + mPresentationId); Log.d(TAG, " mSyncgroupName = " + mSyncgroupName); Log.d(TAG, " Deck = " + mDeck); Log.d(TAG, " mSynced = " + mSynced); if (mRole.equals(Role.AUDIENCE)) { if (mPresentationId.equals(Participant.Unknown.PRESENTATION_ID) || mSyncgroupName.equals(Participant.Unknown.SYNCGROUP_NAME)) { throw new IllegalArgumentException("Cannot be an audience."); } } // TODO(jregan): This appears to be an attempt to avoid fragment // re-inflation, possibly the right thing to do is move the code // below to another flow step, e.g. onRestoreInstanceState. if (savedInstanceState != null) { return; } if (mShouldBeAdvertising) { startAdvertising(); } getSupportActionBar().setTitle(mDeck.getTitle()); // If this is an audience member, we want them to jump straight to the fullscreen view. if (mRole == Role.AUDIENCE) { showFullscreenSlide(0); } else { showSlideList(); } }
From source file:com.vinaysshenoy.easyoauth.factory.OAuthFactory.java
public InputStream executeRequestForInputStream(HttpRequestTypes requestType, String requestUrl, Bundle params) throws OAuthFactoryException, OAuthMessageSignerException, OAuthExpectationFailedException, OAuthCommunicationException, IllegalStateException, IOException { if (accessToken == null) { throw new OAuthFactoryException(OAuthFactoryException.OAuthExceptionMessages.OAUTH_NOT_AUTHORIZED); }//from ww w. j a v a2 s. c om StringBuilder requestParamsBuilder; switch (requestType) { case GET: HttpGet get = null; requestParamsBuilder = new StringBuilder('?'); if (params != null && params.size() > 0) { Set<String> keySet = params.keySet(); Iterator<String> keyIterator = keySet.iterator(); String curKey; while (keyIterator.hasNext()) { curKey = keyIterator.next(); requestParamsBuilder.append(curKey).append('=').append(params.get(curKey)); requestParamsBuilder.append('&'); } } switch (oAuthConfig.oAuthType) { case OAUTH_1_0_A: if (requestParamsBuilder.lastIndexOf("&") != -1) requestParamsBuilder.deleteCharAt(requestParamsBuilder.length() - 1); get = new HttpGet(requestUrl + requestParamsBuilder.toString()); signHttpRequest(get); break; case OAUTH_2_0: requestParamsBuilder.append(oAuthConfig.oAuthToken).append('=').append(accessToken.getToken()); get = new HttpGet(requestUrl + requestParamsBuilder.toString()); break; } return httpManager.executeHttpRequestForStreamResponse(get); case POST: HttpPost post = null; List<NameValuePair> postParams = null; if (params != null && params.size() > 0) { Set<String> keySet = params.keySet(); Iterator<String> keyIterator = keySet.iterator(); String curKey; postParams = new ArrayList<NameValuePair>(params.size()); while (keyIterator.hasNext()) { curKey = keyIterator.next(); postParams.add(new BasicNameValuePair(curKey, params.getString(curKey))); } } switch (oAuthConfig.oAuthType) { case OAUTH_1_0_A: post = new HttpPost(requestUrl); signHttpRequest(post); break; case OAUTH_2_0: requestParamsBuilder = new StringBuilder('?'); requestParamsBuilder.append(oAuthConfig.oAuthToken).append('=').append(accessToken.getToken()); post = new HttpPost(requestUrl + requestParamsBuilder.toString()); break; } post.setEntity(new UrlEncodedFormEntity(postParams)); return httpManager.executeHttpRequestForStreamResponse(post); default: throw new OAuthFactoryException(OAuthFactoryException.OAuthExceptionMessages.UNSUPPORTED_METHOD); } }
From source file:com.vinaysshenoy.easyoauth.factory.OAuthFactory.java
public String executeRequestForString(HttpRequestTypes requestType, String requestUrl, Bundle params) throws OAuthFactoryException, OAuthMessageSignerException, OAuthExpectationFailedException, OAuthCommunicationException, IllegalStateException, IOException { if (accessToken == null) { throw new OAuthFactoryException(OAuthFactoryException.OAuthExceptionMessages.OAUTH_NOT_AUTHORIZED); }//from www .j av a 2 s . co m StringBuilder requestParamsBuilder; switch (requestType) { case GET: HttpGet get = null; requestParamsBuilder = new StringBuilder('?'); if (params != null && params.size() > 0) { Set<String> keySet = params.keySet(); Iterator<String> keyIterator = keySet.iterator(); String curKey; while (keyIterator.hasNext()) { curKey = keyIterator.next(); requestParamsBuilder.append(curKey).append('=').append(params.get(curKey)); requestParamsBuilder.append('&'); } } switch (oAuthConfig.oAuthType) { case OAUTH_1_0_A: if (requestParamsBuilder.lastIndexOf("&") != -1) requestParamsBuilder.deleteCharAt(requestParamsBuilder.length() - 1); get = new HttpGet(requestUrl + requestParamsBuilder.toString()); signHttpRequest(get); break; case OAUTH_2_0: requestParamsBuilder.append(oAuthConfig.oAuthToken).append('=').append(accessToken.getToken()); get = new HttpGet(requestUrl + requestParamsBuilder.toString()); break; } return httpManager.executeHttpRequestForStringResponse(get); case POST: HttpPost post = null; List<NameValuePair> postParams = null; if (params != null && params.size() > 0) { Set<String> keySet = params.keySet(); Iterator<String> keyIterator = keySet.iterator(); String curKey; postParams = new ArrayList<NameValuePair>(params.size()); while (keyIterator.hasNext()) { curKey = keyIterator.next(); postParams.add(new BasicNameValuePair(curKey, params.getString(curKey))); } } switch (oAuthConfig.oAuthType) { case OAUTH_1_0_A: post = new HttpPost(requestUrl); signHttpRequest(post); break; case OAUTH_2_0: requestParamsBuilder = new StringBuilder('?'); requestParamsBuilder.append(oAuthConfig.oAuthToken).append('=').append(accessToken.getToken()); post = new HttpPost(requestUrl + requestParamsBuilder.toString()); break; } post.setEntity(new UrlEncodedFormEntity(postParams)); return httpManager.executeHttpRequestForStringResponse(post); default: throw new OAuthFactoryException(OAuthFactoryException.OAuthExceptionMessages.UNSUPPORTED_METHOD); } }
From source file:com.canappi.connector.yp.yhere.BakeryView.java
public void viewDidLoad() { Bundle extras = getIntent().getExtras(); if (extras != null) { Set<String> keys = extras.keySet(); for (Iterator<String> iter = keys.iterator(); iter.hasNext();) { String key = iter.next(); Class c = SearchView.class; try { Field f = c.getDeclaredField(key); Object extra = extras.get(key); String value = extra.toString(); f.set(this, extras.getString(value)); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace();/* www .j a v a2 s . c om*/ } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } else { } bakeryViewIds = new HashMap(); bakeryViewValues = new HashMap(); isUserDefault = false; resultsListView = (ListView) findViewById(R.id.resultsTable); resultsAdapter = new ResultsEfficientAdapter(this); businessNameArray = new ArrayList<String>(); latitudeArray = new ArrayList<String>(); longitudeArray = new ArrayList<String>(); listingIdArray = new ArrayList<String>(); phoneArray = new ArrayList<String>(); callArray = new ArrayList<String>(); streetArray = new ArrayList<String>(); cityArray = new ArrayList<String>(); resultsListView.setAdapter(resultsAdapter); didSelectViewController(); }
From source file:com.canappi.connector.yp.yhere.GameView.java
public void viewDidLoad() { Bundle extras = getIntent().getExtras(); if (extras != null) { Set<String> keys = extras.keySet(); for (Iterator<String> iter = keys.iterator(); iter.hasNext();) { String key = iter.next(); Class c = SearchView.class; try { Field f = c.getDeclaredField(key); Object extra = extras.get(key); String value = extra.toString(); f.set(this, extras.getString(value)); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace();/*w w w. j av a 2 s. com*/ } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } else { } gameViewIds = new HashMap(); gameViewValues = new HashMap(); isUserDefault = false; resultsListView = (ListView) findViewById(R.id.resultsTable); resultsAdapter = new ResultsEfficientAdapter(this); businessNameArray = new ArrayList<String>(); latitudeArray = new ArrayList<String>(); longitudeArray = new ArrayList<String>(); listingIdArray = new ArrayList<String>(); phoneArray = new ArrayList<String>(); callArray = new ArrayList<String>(); streetArray = new ArrayList<String>(); cityArray = new ArrayList<String>(); resultsListView.setAdapter(resultsAdapter); didSelectViewController(); }
From source file:com.canappi.connector.yp.yhere.GasStationView.java
public void viewDidLoad() { Bundle extras = getIntent().getExtras(); if (extras != null) { Set<String> keys = extras.keySet(); for (Iterator<String> iter = keys.iterator(); iter.hasNext();) { String key = iter.next(); Class c = SearchView.class; try { Field f = c.getDeclaredField(key); Object extra = extras.get(key); String value = extra.toString(); f.set(this, extras.getString(value)); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace();/*from w ww . ja va2s. c o m*/ } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } else { } gasStationViewIds = new HashMap(); gasStationViewValues = new HashMap(); isUserDefault = false; resultsListView = (ListView) findViewById(R.id.resultsTable); resultsAdapter = new ResultsEfficientAdapter(this); businessNameArray = new ArrayList<String>(); latitudeArray = new ArrayList<String>(); longitudeArray = new ArrayList<String>(); listingIdArray = new ArrayList<String>(); phoneArray = new ArrayList<String>(); callArray = new ArrayList<String>(); streetArray = new ArrayList<String>(); cityArray = new ArrayList<String>(); resultsListView.setAdapter(resultsAdapter); didSelectViewController(); }
From source file:com.canappi.connector.yp.yhere.GroceryView.java
public void viewDidLoad() { Bundle extras = getIntent().getExtras(); if (extras != null) { Set<String> keys = extras.keySet(); for (Iterator<String> iter = keys.iterator(); iter.hasNext();) { String key = iter.next(); Class c = SearchView.class; try { Field f = c.getDeclaredField(key); Object extra = extras.get(key); String value = extra.toString(); f.set(this, extras.getString(value)); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace();//from ww w. j av a 2s. c o m } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } else { } groceryViewIds = new HashMap(); groceryViewValues = new HashMap(); isUserDefault = false; resultsListView = (ListView) findViewById(R.id.resultsTable); resultsAdapter = new ResultsEfficientAdapter(this); businessNameArray = new ArrayList<String>(); latitudeArray = new ArrayList<String>(); longitudeArray = new ArrayList<String>(); listingIdArray = new ArrayList<String>(); phoneArray = new ArrayList<String>(); callArray = new ArrayList<String>(); streetArray = new ArrayList<String>(); cityArray = new ArrayList<String>(); resultsListView.setAdapter(resultsAdapter); didSelectViewController(); }
From source file:com.canappi.connector.yp.yhere.LubeView.java
public void viewDidLoad() { Bundle extras = getIntent().getExtras(); if (extras != null) { Set<String> keys = extras.keySet(); for (Iterator<String> iter = keys.iterator(); iter.hasNext();) { String key = iter.next(); Class c = SearchView.class; try { Field f = c.getDeclaredField(key); Object extra = extras.get(key); String value = extra.toString(); f.set(this, extras.getString(value)); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace();//ww w. j a v a 2s .co m } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } else { } lubeViewIds = new HashMap(); lubeViewValues = new HashMap(); isUserDefault = false; resultsListView = (ListView) findViewById(R.id.resultsTable); resultsAdapter = new ResultsEfficientAdapter(this); businessNameArray = new ArrayList<String>(); latitudeArray = new ArrayList<String>(); longitudeArray = new ArrayList<String>(); listingIdArray = new ArrayList<String>(); phoneArray = new ArrayList<String>(); callArray = new ArrayList<String>(); streetArray = new ArrayList<String>(); cityArray = new ArrayList<String>(); resultsListView.setAdapter(resultsAdapter); didSelectViewController(); }
From source file:com.canappi.connector.yp.yhere.RepairView.java
public void viewDidLoad() { Bundle extras = getIntent().getExtras(); if (extras != null) { Set<String> keys = extras.keySet(); for (Iterator<String> iter = keys.iterator(); iter.hasNext();) { String key = iter.next(); Class c = SearchView.class; try { Field f = c.getDeclaredField(key); Object extra = extras.get(key); String value = extra.toString(); f.set(this, extras.getString(value)); } catch (SecurityException e) { // TODO Auto-generated catch block e.printStackTrace();/*from ww w . j av a2s.co m*/ } catch (NoSuchFieldException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalArgumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } else { } repairViewIds = new HashMap(); repairViewValues = new HashMap(); isUserDefault = false; resultsListView = (ListView) findViewById(R.id.resultsTable); resultsAdapter = new ResultsEfficientAdapter(this); businessNameArray = new ArrayList<String>(); latitudeArray = new ArrayList<String>(); longitudeArray = new ArrayList<String>(); listingIdArray = new ArrayList<String>(); phoneArray = new ArrayList<String>(); callArray = new ArrayList<String>(); streetArray = new ArrayList<String>(); cityArray = new ArrayList<String>(); resultsListView.setAdapter(resultsAdapter); didSelectViewController(); }