List of usage examples for android.os Bundle getString
@Nullable
public String getString(@Nullable String key)
From source file:com.onesignal.OneSignal.java
private static void init(OneSignal.Builder inBuilder) { mInitBuilder = inBuilder;/*from w ww.j av a 2 s . c om*/ Context context = mInitBuilder.mContext; mInitBuilder.mContext = null; // Clear to prevent leaks. try { ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA); Bundle bundle = ai.metaData; OneSignal.init(context, bundle.getString("onesignal_google_project_number").substring(4), bundle.getString("onesignal_app_id"), mInitBuilder.mNotificationOpenedHandler); } catch (Throwable t) { t.printStackTrace(); } }
From source file:com.example.karspoolingapp.RouteByHitchhikerCar.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.routebyhitchhiker); Intent intent = getIntent();/*w w w . j a va 2 s . co m*/ Bundle bundle = intent.getExtras(); new_license_number = bundle.getString("pre_end_point"); //session_username = session.getUsername(); System.out.println("nayaaa licnse number" + new_license_number); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); // code for dynamic radio button generation final RadioButton[] rb = new RadioButton[100]; rl = (RelativeLayout) findViewById(R.id.rl); rg = new RadioGroup(this); // Building Parameters List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("car_number", new_license_number)); System.out.println(params); json = jsonParser.makeHttpRequest(READ_COMMENTS_URL2, "POST", params); params.clear(); System.out.println(json); try { jsonTripDetails = json.getJSONArray("route"); System.out.println(jsonTripDetails); int k = jsonTripDetails.length(); if (k > 0) { for (int i = 0; i < jsonTripDetails.length(); i++) { JSONObject c = jsonTripDetails.getJSONObject(i); String parent_username_str = c.getString("username"); String route = c.getString("route"); String timing = c.getString("timing"); String seating = c.getString("seating_capacity"); rb[i] = new RadioButton(this); rg.addView(rb[i]); rb[i].setText(parent_username_str + "," + route + "," + timing + "," + seating); params.clear(); } rl.addView(rg); rl.setPadding(50, 50, 50, 50); } else { Toast.makeText(RouteByHitchhikerCar.this, "No Trip available on these routes", Toast.LENGTH_LONG) .show(); } } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } addListenerOnButton(); }
From source file:com.grouzen.android.serenity.HttpConnection.java
private ArrayList<NameValuePair> convertParams(Bundle params) { ArrayList<NameValuePair> entity = new ArrayList<NameValuePair>(); for (String k : params.keySet()) { entity.add(new BasicNameValuePair(k, params.getString(k))); }// w w w .j ava 2 s . com return entity; }
From source file:com.krayzk9s.imgurholo.ui.AccountFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); refreshedCount = 0;/*from w ww. ja v a2 s .co m*/ Bundle bundle = getArguments(); username = bundle.getString("username"); setHasOptionsMenu(true); }
From source file:edu.cwru.apo.Login.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login);//from w w w.ja v a2 s.co m Bundle extras = getIntent().getExtras(); if (extras.get("msg") != null) { Toast message = Toast.makeText(getApplicationContext(), extras.getString("msg"), Toast.LENGTH_SHORT); message.show(); } // map the login button to the layout login_btn = (Button) findViewById(R.id.login); login_btn.setOnClickListener(this); // map the forgot password button to the layout forgot_btn = (Button) findViewById(R.id.forgot_password); forgot_btn.setOnClickListener(this); username = (EditText) findViewById(R.id.username); password = (EditText) findViewById(R.id.password); }
From source file:com.kakao.authorization.accesstoken.GetterAccessToken.java
private BoundRequestBuilder makeAccessTokenRequest() { final BoundRequestBuilder requestBuilder = HttpRequestTask.ASYNC_HTTP_CLIENT.preparePost( HttpRequestTask.createBaseURL(ServerProtocol.AUTH_AUTHORITY, ServerProtocol.ACCESS_TOKEN_PATH)); final Entry<String, String> entry = HttpRequestTask.KA_HEADER.entrySet().iterator().next(); requestBuilder.addHeader(entry.getKey(), entry.getValue()); if (accessTokenRequest.isAccessTokenRequestWithAuthCode()) { requestBuilder.addQueryParameter(ServerProtocol.GRANT_TYPE_KEY, ServerProtocol.GRANT_TYPE_AUTHORIZATION_CODE); requestBuilder.addQueryParameter(ServerProtocol.CODE_KEY, accessTokenRequest.getAuthorizationCode()); requestBuilder.addQueryParameter(ServerProtocol.REDIRECT_URI_KEY, accessTokenRequest.getRedirectURI()); } else { //if(request.isAccessTokenRequestWithRefreshToken()) { requestBuilder.addQueryParameter(ServerProtocol.GRANT_TYPE_KEY, ServerProtocol.REFRESH_TOKEN_KEY); requestBuilder.addQueryParameter(ServerProtocol.REFRESH_TOKEN_KEY, accessTokenRequest.getRefreshToken()); }// w w w.jav a 2s. c o m requestBuilder.addQueryParameter(ServerProtocol.CLIENT_ID_KEY, accessTokenRequest.getAppKey()); requestBuilder.addQueryParameter(ServerProtocol.ANDROID_KEY_HASH, accessTokenRequest.getKeyHash()); final Bundle extraParams = accessTokenRequest.getExtras(); if (extraParams != null && !extraParams.isEmpty()) { for (String key : extraParams.keySet()) { String value = extraParams.getString(key); if (value != null) { requestBuilder.addQueryParameter(key, value); } } } return requestBuilder; }
From source file:com.liferay.alerts.receiver.PushNotificationIntentService.java
@Override protected void onHandleIntent(Intent intent) { GoogleCloudMessaging gcm = GCMUtil.getGoogleCloudMessaging(this); String type = gcm.getMessageType(intent); Bundle extras = intent.getExtras(); if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE.equals(type) && !extras.isEmpty()) { try {/*from w ww . j a v a 2 s . c om*/ long parentPushNotificationsEntryId = Long .parseLong(extras.getString(Alert.PARENT_PUSH_NOTIFICATIONS_ENTRY_ID)); if (parentPushNotificationsEntryId != 0) { return; } long id = Long.parseLong(extras.getString(Alert.PUSH_NOTIFICATIONS_ENTRY_ID)); JSONObject userJSONObject = new JSONObject(extras.getString(Alert.USER)); User user = new User(userJSONObject); JSONObject payload = new JSONObject(extras.getString(Alert.PAYLOAD)); Alert alert = new Alert(id, user, payload); _insert(user, alert); NotificationUtil.notifyUnreadAlerts(this); MainActivity.addCard(this, alert); } catch (JSONException je) { Log.e(_TAG, "Couldn't parse alert JSON.", je); } finally { PushNotificationReceiver.completeWakefulIntent(intent); } } }
From source file:de.stadtrallye.rallyesoft.services.GcmIntentService.java
@Override protected void onMessage(Bundle message) { Log.i(THIS, "Received Push: " + message); Context context = getApplicationContext(); try {//from w ww . jav a 2 s.com PushEntity.Type type = PushEntity.Type.valueOf(message.getString(PushEntity.TYPE)); ObjectMapper mapper = Serialization.getJsonInstance(); switch (type) { case newMessage: PushChatEntry<ChatEntry> chat = mapper.readValue(message.getString(PushEntity.PAYLOAD), new TypeReference<PushChatEntry<ChatEntry>>() { }); IChatroom chatroom = chatManager.findChatroom(chat.roomID); chatroom.pushChat(chat.entry, notificationManager); break; case messageChanged: chat = mapper.readValue(message.getString(PushEntity.PAYLOAD), new TypeReference<PushChatEntry<ChatEntry>>() { }); chatroom = chatManager.findChatroom(chat.roomID); chatroom.editChat(chat.entry); break; case newSubmission: PushSubmission submission = mapper.readValue(message.getString(PushEntity.PAYLOAD), PushSubmission.class); taskManager.pushSubmission(submission); break; case setPrimarySubmission: PushPrimarySubmissionConfig primary = mapper.readValue(message.getString(PushEntity.PAYLOAD), PushPrimarySubmissionConfig.class); taskManager.pushActiveSubmission(primary); case refreshTasks: taskManager.forceRefresh(); break; case refreshChatrooms: chatManager.forceRefreshChatrooms(); break; case pingLocation: new LocationManager(this, LocationManager.Mode.PING); break; default: } } catch (IOException e) { Log.e(THIS, "Push Message not compatible", e); } }
From source file:se.anyro.tagtider.StationActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.transfers);/*w ww. ja v a 2 s .c o m*/ Bundle extras = getIntent().getExtras(); mStationName = extras.getString("stationName"); mStationId = extras.getInt("stationId"); mType = extras.getString("type"); if (!mType.equals(sLastType) || mStationId != sLastStationId) { sLastUpdate = 0; // Make sure we reload the data sLastStationId = mStationId; sLastType = mType; } TextView title = (TextView) findViewById(R.id.title); TextView place = (TextView) findViewById(R.id.place); if (Station.ARRIVIALS.equals(mType)) { title.setText(mStationName + " - Ankomster"); mFrom = FROM_ARRIVAL; place.setText("Frn"); } else { title.setText(mStationName + " - Avgngar"); mFrom = FROM_DEPARTURE; place.setText("Till"); } mEmptyView = (TextView) findViewById(android.R.id.empty); mProgress = findViewById(R.id.progress); }
From source file:my.com.nexstream.konnectedpay.KonnectedPayCordova.java
@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == Payment.PAYMENT_RETURN && paymentOngoing && paymentCallbackContext != null) { try {//from w ww. j a v a 2 s.c om if (intent == null) throw new NoResponseException(); Bundle extras = intent.getExtras(); if (extras == null) throw new NoResponseException(); String status = extras.getString("status"); JSONObject resp = new JSONObject(); resp.put("amount", extras.getString("amount")); resp.put("status", status); resp.put("code", extras.getString("code")); resp.put("desc", extras.getString("desc")); resp.put("tranId", extras.getString("tranId")); if (status.equals("S")) paymentCallbackContext.success(resp); else paymentCallbackContext.error(resp); } catch (NoResponseException e) { paymentCallbackContext.error(ERROR_NO_RESPONSE_RECEIVED); } catch (Exception e) { paymentCallbackContext.error("Unexpected failure: " + e.getMessage()); } finally { paymentOngoing = false; paymentCallbackContext = null; } } }