Example usage for android.os Bundle get

List of usage examples for android.os Bundle get

Introduction

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

Prototype

@Nullable
public Object get(String key) 

Source Link

Document

Returns the entry with the given key as an object.

Usage

From source file:com.precisosol.llgeofence.GeofencePlugin.java

private void geofenceFired(Bundle extras) {
    BorderEvent borderEvent = (BorderEvent) extras.get(BorderEvent.EXTRA_BORDER_EVENT);
    Geofence geofence = (Geofence) extras.get(Geofence.EXTRA_GEOFENCE);
    if (borderEvent == null || geofence == null) {
        Log.w(LOG, "Geofence fired, but report is incomplete.  Will not notify user: " + extras);
    } else {//  ww  w .  j  a va 2s  . co  m
        GeofenceSpec spec = geofence.getSpec();
        if (spec == null) {
            Log.w(LOG, "GeofenceSpec not available");
        } else {
            if (spec instanceof CircularGeofenceSpec) {
                CircularGeofenceSpec circSpec = (CircularGeofenceSpec) spec;
                // location of BorderEvent would be another option
            } else {
                Log.w(LOG, "Unknown type of GeofenceSpec: " + spec.getClass().getName());
            }
        }

        //alert(title.toString(), msg.toString());
    }
}

From source file:cn.laojing.smarthome.VoiceActivity.java

@Override
public void onEvent(int eventType, Bundle params) {
    switch (eventType) {
    case EVENT_ERROR:
        String reason = params.get("reason") + "";
        print("EVENT_ERROR, " + reason);
        break;/*from w ww . ja  v a2  s  .c o  m*/
    case VoiceRecognitionService.EVENT_ENGINE_SWITCH:
        int type = params.getInt("engine_type");
        print("*?" + (type == 0 ? "" : ""));
        break;
    }
}

From source file:fm.smart.r1.CreateSoundActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ExceptionHandler.register(this);
    setContentView(R.layout.create_sound);
    final Intent queryIntent = getIntent();
    Bundle extras = queryIntent.getExtras();
    item_id = (String) extras.get("item_id");
    id = (String) extras.get("id");
    goal_id = (String) extras.get("goal_id"); // not being added at present
    // TODO//ww  w .  j  a  va  2  s.co  m
    to_record = (String) extras.get("to_record");
    sound_type = extras.getString("sound_type");

    recorder = new MediaRecorder();

    TextView text = (TextView) findViewById(R.id.create_sound_text);
    text.setText(Html.fromHtml(to_record));
    button = (Button) findViewById(R.id.create_sound_submit);
    button.setOnClickListener(this);

}

From source file:com.example.parking.ParkingInformationActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (data != null) {
        switch (requestCode) {
        case TAKE_PHOTO: //?
            if (data.getData() != null || data.getExtras() != null) { //
                Uri uri = data.getData();
                if (uri != null) {
                    if (mEnterImage == null) {
                        mEnterImage = BitmapFactory.decodeFile(uri.getPath()); //
                    }//from   w w w. j  av a 2  s.c  o  m
                }
                Bundle bundle = data.getExtras();
                if (bundle != null) {
                    if (mEnterImage == null) {
                        mEnterImage = (Bitmap) bundle.get("data");
                    }
                }
            }
            if (mEnterImage != null) {
                mEnterImageIV.setImageBitmap(mEnterImage);
            }
            break;

        }
    }

}

From source file:com.microsoft.filediscovery.FileItemActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    mApplication = (DiscoveryAPIApplication) getApplication();
    setContentView(R.layout.activity_file_display);

    Bundle bundle = getIntent().getExtras();
    Uri imageUri = (Uri) bundle.get(Intent.EXTRA_STREAM);

    try {// www. j ava2s. c o  m
        if (imageUri != null) {
            bundle = new ShareTask(this, imageUri, getIntent()).execute().get().getExtras();
        }

        DisplayMetrics displayMetrics = new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
        mResizer = new BitmapResizer(displayMetrics);

        String data = bundle.getString(Constants.DATA);
        if (data != null) {
            JSONObject payload;

            payload = new JSONObject(data);
            mFileSaveItem = new FileItem();
            mResourceId = payload.getString(Constants.RESOURCEID);
            mEndPoint = payload.getString(Constants.ENDPOINT);
            mFileSaveItem.setResourceId(mResourceId);
            mFileSaveItem.setEndpoint(mEndPoint);

            ShowImageToShare(Uri.parse(payload.getString("uri")));
        }
    } catch (Exception e) {
        Log.e("Asset", e.getMessage());
    }
}

From source file:com.blogspot.marioboehmer.thingibrowse.fragments.ThingDetailsFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState == null) {
        savedInstanceState = getActivity().getIntent().getExtras();
    }/*from ww  w. j  av  a  2 s .  c o  m*/
    if (savedInstanceState != null) {
        thing = (Thing) savedInstanceState.get(THING);
        thingUrl = savedInstanceState.getString(THING_URL);
    }
    imageTagFactory = new ImageTagFactory(getActivity(), R.drawable.image_loading);
    imageTagFactory.setErrorImageId(R.drawable.info);
    imageLoader = ThingiBrowseApplication.getImageManager().getLoader();
}

From source file:fm.smart.r1.activity.CreateSoundActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ExceptionHandler.register(this);
    setContentView(R.layout.create_sound);
    final Intent queryIntent = getIntent();
    Bundle extras = queryIntent.getExtras();
    item_id = (String) extras.get("item_id");
    id = (String) extras.get("id");
    list_id = (String) extras.get("list_id");
    to_record = (String) extras.get("to_record");
    sound_type = extras.getString("sound_type");

    recorder = new MediaRecorder();

    TextView text = (TextView) findViewById(R.id.create_sound_text);
    text.setText(Html.fromHtml(to_record));
    button = (Button) findViewById(R.id.create_sound_submit);
    button.setOnClickListener(this);

}

From source file:bolts.MeasurementEvent.java

private static Bundle getApplinkLogData(Context context, String eventName, Bundle appLinkData,
        Intent applinkIntent) {//from   w  w  w  .  ja v  a 2 s  .c o m
    Bundle logData = new Bundle();
    ComponentName resolvedActivity = applinkIntent.resolveActivity(context.getPackageManager());

    if (resolvedActivity != null) {
        logData.putString("class", resolvedActivity.getShortClassName());
    }

    if (APP_LINK_NAVIGATE_OUT_EVENT_NAME.equals(eventName)) {
        if (resolvedActivity != null) {
            logData.putString("package", resolvedActivity.getPackageName());
        }
        if (applinkIntent.getData() != null) {
            logData.putString("outputURL", applinkIntent.getData().toString());
        }
        if (applinkIntent.getScheme() != null) {
            logData.putString("outputURLScheme", applinkIntent.getScheme());
        }
    } else if (APP_LINK_NAVIGATE_IN_EVENT_NAME.equals(eventName)) {
        if (applinkIntent.getData() != null) {
            logData.putString("inputURL", applinkIntent.getData().toString());
        }
        if (applinkIntent.getScheme() != null) {
            logData.putString("inputURLScheme", applinkIntent.getScheme());
        }
    }

    for (String key : appLinkData.keySet()) {
        Object o = appLinkData.get(key);
        if (o instanceof Bundle) {
            for (String subKey : ((Bundle) o).keySet()) {
                String logValue = objectToJSONString(((Bundle) o).get(subKey));
                if (key.equals("referer_app_link")) {
                    if (subKey.equalsIgnoreCase("url")) {
                        logData.putString("refererURL", logValue);
                        continue;
                    } else if (subKey.equalsIgnoreCase("app_name")) {
                        logData.putString("refererAppName", logValue);
                        continue;
                    } else if (subKey.equalsIgnoreCase("package")) {
                        logData.putString("sourceApplication", logValue);
                        continue;
                    }
                }
                logData.putString(key + "/" + subKey, logValue);
            }
        } else {
            String logValue = objectToJSONString(o);
            if (key.equals("target_url")) {
                Uri targetURI = Uri.parse(logValue);
                logData.putString("targetURL", targetURI.toString());
                logData.putString("targetURLHost", targetURI.getHost());
                continue;
            }
            logData.putString(key, logValue);
        }
    }
    return logData;
}

From source file:com.juanojfp.gcmsample.MainActivity.java

private void getExtrasFromIntent(Intent it) {
    if (it != null && it.getExtras() != null) {
        Log.e("Intent GCM ", it.getExtras().toString());
        Bundle bundle = it.getExtras();
        StringBuilder sb = new StringBuilder();
        for (String key : bundle.keySet()) {
            Object value = bundle.get(key);
            String msg = String.format("%s %s (%s)", key, value.toString(), value.getClass().getName());
            sb.append(msg).append("\n");
            Log.d(TAG, msg);//from   w w w  .j ava 2s  .com
        }

        if (mDisplay != null)
            mDisplay.setText(sb.toString());

    } else
        Log.e("Intent GCM ", "NO DATA IN INTENT");
}

From source file:org.alfresco.mobile.android.application.fragments.node.search.DocumentFolderSearchFragment.java

@Override
protected void onRetrieveParameters(Bundle bundle) {
    super.onRetrieveParameters(bundle);
    if (TextUtils.isEmpty(title) && bundle.containsKey(ARGUMENT_TITLE)) {
        title = (String) bundle.get(ARGUMENT_TITLE);
    }/*  www . ja  v a 2s.co m*/
    if (keywords != null) {
        title = String.format(getString(R.string.search_title), keywords);
    }
}