Example usage for android.os Bundle getString

List of usage examples for android.os Bundle getString

Introduction

In this page you can find the example usage for android.os Bundle getString.

Prototype

@Nullable
public String getString(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:Main.java

public static void registerNewSourceSinkConnection(int counter, Bundle bundle) {
    Log.i("PEP", "in registerNewSourceSinkConnection(int counter, Bundle bundle)" + counter + " "
            + bundle.toString());//from   w  w w. ja  v a2s .  c o m
    int taintInfoKeyCounter = 0;

    if (bundle != null) {
        for (String intentKey : bundle.keySet()) {
            if (intentKey.startsWith(keyBaseName)) {
                String possibleNumber = intentKey.substring(keyBaseName.length());
                if (possibleNumber.length() > 0 && TextUtils.isDigitsOnly(possibleNumber)) {
                    int currentCounter = Integer.parseInt(possibleNumber);
                    if (taintInfoKeyCounter < currentCounter)
                        taintInfoKeyCounter = currentCounter;
                }
            }
        }

        if (taintInfoKeyCounter == 0) {
            Log.i("PEP", "bundle:" + bundle.toString());
            if (bundle.containsKey(keyBaseName)) {
                String taintSourceCats = bundle.getString(keyBaseName);
                String[] allCats = taintSourceCats.split(",");
                sourceSinkConnection.put(counter, new HashSet<String>(Arrays.asList(allCats)));
            }
        } else {
            if (bundle.containsKey(keyBaseName + taintInfoKeyCounter)) {
                String taintSourceCats = bundle.getString(keyBaseName + taintInfoKeyCounter);
                String[] allCats = taintSourceCats.split(",");
                sourceSinkConnection.put(counter, new HashSet<String>(Arrays.asList(allCats)));
            }
        }
    }
}

From source file:com.sidekickApp.PusherCallback.java

public void handleMessage(Message message) {
    Bundle payload = message.getData();
    String eventName = payload.getString("eventName");
    String channelName = payload.getString("channelName");
    String eventData = payload.getString("eventData");

    onEvent(eventName, eventData, channelName);
}

From source file:com.lukasz.chat.pusher.PusherCallback.java

public void handleMessage(Message message) {
    Log.d("MESSAGE", "Reveive some message");
    Bundle payload = message.getData();
    String eventName = payload.getString("eventName");
    String channelName = payload.getString("channelName");
    String eventData = payload.getString("eventData");

    onEvent(eventName, eventData, channelName);
}

From source file:angel.zhuoxiu.library.pusher.PusherCallback.java

public void handleMessage(Message message) {
    Bundle payload = message.getData();
    String eventName = payload.getString("eventName");
    String channelName = payload.getString("channelName");
    String eventData = payload.getString("eventData");
    onEvent(eventName, eventData, channelName);
}

From source file:li.klass.fhem.fragments.FloorplanFragment.java

@SuppressWarnings("unused")
public FloorplanFragment(Bundle bundle) {
    super(bundle);

    deviceName = bundle.getString(BundleExtraKeys.DEVICE_NAME);
}

From source file:com.gigigo.orchextra.device.notificationpush.OrchextraGcmListenerService.java

private String getMessageFromBundle(Bundle data) {
    try {/*from  ww  w.j a  va 2s  . c  om*/
        return new JSONObject(data.getString("data")).getString("alert");
    } catch (Exception e) {
        return "";
    }
}

From source file:com.rastating.droidbeard.ErrorReportActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.error_report);

    mReport = new JSONObject();
    try {//from  ww  w .  j  a v  a 2  s .co m
        Preferences preferences = new Preferences(this);
        if (savedInstanceState == null) {
            Bundle extras = getIntent().getExtras();
            String exception = extras.getString("exception");
            mReport.put("exception", exception == null ? "" : exception);
            mReport.put("stackTrace", extras.getString("stackTrace"));
            mReport.put("https_enabled", preferences.getHttpsEnabled());
            mReport.put("trust_all_certificates", preferences.getTrustAllCertificatesFlag());
            mReport.put("version", Application.getVersionName());
            mReport.put("data", extras.getString("data"));
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    ((EditText) findViewById(R.id.exception)).setText(mReport.toString());
    findViewById(R.id.send).setOnClickListener(this);
}

From source file:fr.julienvermet.bugdroid.service.CommentIntentService.java

@Override
protected void onHandleIntent(Intent intent) {
    Bundle bundle = intent.getExtras();
    String query = bundle.getString(QUERY);
    String jsonDataString = bundle.getString(JSON_DATA);
    try {//  w  w  w . j  av  a2  s.c  om
        JSONObject jsonData = new JSONObject(jsonDataString);
        NetworkResult networkResult = NetworkUtils.postJson(query, jsonData);
        sendResult(intent, networkResult.statusCode, networkResult.result);
    } catch (JSONException e) {
        sendResult(intent, 0, "JSONException");
        e.printStackTrace();
    }
}

From source file:DetailFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    Bundle bundle = getArguments();
    if (bundle != null && bundle.containsKey(KEY_COUNTRY_NAME)) {
        showSelectedCountry(bundle.getString(KEY_COUNTRY_NAME));
    }/*ww  w .jav a2s  .  c om*/
}

From source file:com.versul.newbornswatcher.MyGcmListenerService.java

/**
 * Called when message is received.//from  ww w.jav  a  2s .  c  o  m
 *
 * @param from SenderID of the sender.
 * @param data Data bundle containing message data as key/value pairs.
 *             For Set of keys use data.keySet().
 */
// [START receive_message]
@Override
public void onMessageReceived(String from, Bundle data) {
    String message = data.getString("message");
    Log.d(TAG, "From: " + from);
    Log.d(TAG, "Message: " + message);

    try {
        save(message);
    } catch (JSONException e) {
        e.printStackTrace();
    }

    try {
        sendNotification((new JSONObject(message)).get("origin").toString());
    } catch (JSONException e) {
        e.printStackTrace();
    }

    refreshMain();

}