Example usage for android.os Bundle Bundle

List of usage examples for android.os Bundle Bundle

Introduction

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

Prototype

public Bundle() 

Source Link

Document

Constructs a new, empty Bundle.

Usage

From source file:com.facebook.android.FQLQuery.java

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

    mHandler = new Handler();

    setContentView(R.layout.fql_query);//from   w  w w.  j  a  v a 2 s.c om
    LayoutParams params = getWindow().getAttributes();
    params.width = LayoutParams.FILL_PARENT;
    params.height = LayoutParams.FILL_PARENT;
    getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);

    mFQLQuery = (EditText) findViewById(R.id.fqlquery);
    mFQLOutput = (TextView) findViewById(R.id.fqlOutput);
    mSubmitButton = (Button) findViewById(R.id.submit_button);

    mSubmitButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ((InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE))
                    .hideSoftInputFromWindow(mFQLQuery.getWindowToken(), 0);
            dialog = ProgressDialog.show(FQLQuery.this.activity, "",
                    FQLQuery.this.activity.getString(R.string.please_wait), true, true);
            /*
             * Source tag: fql_query_tag
             */
            String query = mFQLQuery.getText().toString();
            Bundle params = new Bundle();
            params.putString("method", "fql.query");
            params.putString("query", query);
            Utility.mAsyncRunner.request(null, params, new FQLRequestListener());
        }
    });
}

From source file:com.kennethmaffei.infinitegrid.HTTPCommManager.java

/**
 * Sets up a headless fragment that calls an AsyncTask to retrieve records in the db
 * // w  ww.  j a va2 s.  c  om
 * @param activity - the activity, needed to access the fragment manager
 */
public void getDBData() {
    if (activity == null)
        return;

    synchronized (synchronizeObject) {
        if (!retrievalDone)
            return;

        retrievalDone = false;
        imageCount = 0;
        FragmentManager fm = activity.getFragmentManager();
        TaskFragment taskFragment = (TaskFragment) fm.findFragmentByTag(Constants.TAG_TASK_GETALLRECORDS);

        //If the Fragment is non-null, then it is currently being retained across a configuration change.         
        if (taskFragment == null) {
            taskFragment = new TaskFragment();
            Bundle args = new Bundle();
            args.putInt("type", CALLTYPE.ALL_RECORDS.ordinal());
            taskFragment.setArguments(args);
            fm.beginTransaction().add(taskFragment, Constants.TAG_TASK_GETALLRECORDS).commit();
        }
    }
}

From source file:com.parse.simple.SimpleParse.java

public synchronized static ParseObject commit(Object from, ParseObject to) {
    for (Map.Entry<SimpleField, SimpleParseColumn> fieldEntry : SimpleParseCache.get()
            .getColumnFields(from.getClass()).entrySet()) {
        final SimpleField field = fieldEntry.getKey();
        final SimpleParseColumn column = fieldEntry.getValue();
        final String columnName = SimpleParseCache.get().getColumnName(field, column);

        if (TextUtils.isEmpty(columnName))
            continue;

        Bundle icicle = SimpleParseCache.get().columnDataCache.get(columnName);
        if (icicle == null) {
            icicle = new Bundle();
            SimpleParseCache.get().columnDataCache.put(columnName, icicle);
        }//from  w ww. j  ava  2 s  .c o m

        Class<?> fieldType = field.getType();
        try {
            Object value = field.get(from);

            Class<? extends Filter> filter = column.filter();
            if (!Optional.class.equals(column.saver())) {
                value = ((Value) SimpleParseCache.get().getObject(column.saver())).value();
            } else if (NullValue.class.equals(column.saver())) {
                continue;
            } else if (!OptionalFilter.class.equals(filter)) {
                value = SimpleParseCache.get().getFilter(filter).onSave(value, icicle, from, to);
            }

            if (column.self() && fieldType.isAssignableFrom(ParseObject.class)) {
                // do nothing
            } else if (value == null) {
                to.put(columnName, JSONObject.NULL);
                //to.remove(columnName);
            } else if (fieldType.equals(Byte.class) || fieldType.equals(byte.class)) {
                to.put(columnName, (Byte) value);
            } else if (fieldType.equals(Short.class) || fieldType.equals(short.class)) {
                to.put(columnName, (Short) value);
            } else if (fieldType.equals(Integer.class) || fieldType.equals(int.class)) {
                to.put(columnName, (Integer) value);
            } else if (fieldType.equals(Long.class) || fieldType.equals(long.class)) {
                to.put(columnName, (Long) value);
            } else if (fieldType.equals(Float.class) || fieldType.equals(float.class)) {
                to.put(columnName, (Float) value);
            } else if (fieldType.equals(Double.class) || fieldType.equals(double.class)) {
                to.put(columnName, (Double) value);
            } else if (fieldType.equals(Boolean.class) || fieldType.equals(boolean.class)) {
                to.put(columnName, (Boolean) value);
            } else if (fieldType.equals(Character.class) || fieldType.equals(char.class)) {
                to.put(columnName, value.toString());
            } else if (fieldType.equals(String.class)) {
                String valueString = value.toString();
                String prefix = column.prefix();
                String suffix = column.suffix();

                Class<?> prefixClass = column.prefixClass();
                if (!Optional.class.equals(prefixClass)) {
                    prefix = (String) ((Value) SimpleParseCache.get().getObject(prefixClass)).value();
                }

                Class<?> suffixClass = column.suffixClass();
                if (!Optional.class.equals(suffixClass)) {
                    suffix = (String) ((Value) SimpleParseCache.get().getObject(suffixClass)).value();
                }

                if (!TextUtils.isEmpty(prefix) && valueString.startsWith(prefix)) {
                    //valueString.replace(prefix, "");
                    valueString = valueString.substring(prefix.length(), valueString.length());
                }

                if (!TextUtils.isEmpty(suffix) && valueString.endsWith(suffix)) {
                    valueString = valueString.substring(0, valueString.length() - suffix.length());
                }

                if (SimpleParseObject.OBJECT_ID.equals(columnName)) {
                    to.setObjectId(valueString);
                } else {
                    to.put(columnName, valueString);
                }
            } else if (fieldType.equals(Byte[].class) || fieldType.equals(byte[].class)) {
                to.put(columnName, (byte[]) value);
            } else if (fieldType.equals(JSONObject.class)) {
                to.put(columnName, (JSONObject) value);
            } else if (fieldType.equals(List.class)) {
                to.addAll(columnName, (List) value);
            } else if (fieldType.equals(Date.class)) {
                to.put(columnName, (Date) value);
            } else if (fieldType.equals(ParseUser.class)) {
                to.put(columnName, (ParseUser) value);
            } else if (fieldType.equals(ParseGeoPoint.class)) {
                to.put(columnName, (ParseGeoPoint) value);
            } else if (fieldType.equals(ParseObject.class)) {
                to.put(columnName, (ParseObject) value);
            }
            //else if (ReflectionUtils.isSubclassOf(fieldType, Enum.class)) {
            //to.put(columnName, ((Enum<?>) value).name());
            //}
        } catch (IllegalArgumentException e) {
        } catch (IllegalAccessException e) {
        }
    }
    SimpleParseCache.get().columnDataCache.clear();
    return to;
}

From source file:com.normalexception.app.rx8club.task.ProfileTask.java

@Override
protected void onPostExecute(Void result) {
    try {//from   ww w .  j a v a2 s .  c om
        mProgressDialog.dismiss();
        mProgressDialog = null;
    } catch (Exception e) {
        Log.w(TAG, e.getMessage());
    }

    Bundle args = new Bundle();
    args.putString("link", HtmlFormUtils.getResponseUrl());
    FragmentUtils.fragmentTransaction(sourceFragment.getActivity(), new UserCpFragment(), false, true, args);
}

From source file:eu.faircode.adblocker.IAB.java

public boolean isAvailable(String sku) throws RemoteException, JSONException {
    // Get available SKUs
    ArrayList<String> skuList = new ArrayList<>();
    skuList.add(sku);//www. j  a v  a  2  s  . c  o  m
    Bundle query = new Bundle();
    query.putStringArrayList("ITEM_ID_LIST", skuList);
    Bundle bundle = service.getSkuDetails(IAB_VERSION, context.getPackageName(), "inapp", query);
    Log.i(TAG, "getSkuDetails");
    Util.logBundle(bundle);
    int response = (bundle == null ? -1 : bundle.getInt("RESPONSE_CODE", -1));
    Log.i(TAG, "Response=" + getResult(response));
    if (response != 0)
        throw new IllegalArgumentException(getResult(response));

    // Check available SKUs
    boolean found = false;
    ArrayList<String> details = bundle.getStringArrayList("DETAILS_LIST");
    if (details != null)
        for (String item : details) {
            JSONObject object = new JSONObject(item);
            if (sku.equals(object.getString("productId"))) {
                found = true;
                break;
            }
        }
    Log.i(TAG, sku + "=" + found);

    return found;
}

From source file:com.google.android.apps.muzei.api.internal.SourceState.java

public Bundle toBundle() {
    Bundle bundle = new Bundle();
    if (mCurrentArtwork != null) {
        bundle.putBundle("currentArtwork", mCurrentArtwork.toBundle());
    }/*  ww  w  . j av  a 2s  .c  om*/
    bundle.putString("description", mDescription);
    bundle.putBoolean("wantsNetworkAvailable", mWantsNetworkAvailable);
    String[] commandsSerialized = new String[mUserCommands.size()];
    for (int i = 0; i < commandsSerialized.length; i++) {
        commandsSerialized[i] = mUserCommands.get(i).serialize();
    }
    bundle.putStringArray("userCommands", commandsSerialized);
    return bundle;
}

From source file:com.geozen.demo.foursquare.jiramot.Util.java

/**
 * Parse a URL query and fragment parameters into a key-value bundle.
 * /*w ww .  jav  a 2  s .  c om*/
 * @param url
 *            the URL to parse
 * @return a dictionary bundle of keys and values
 */
public static Bundle parseUrl(String url) {
    // hack to prevent MalformedURLException
    url = url.replace("#", "?");

    try {
        URL u = new URL(url);
        Bundle b = decodeUrl(u.getQuery());
        // b.putAll(decodeUrl(u.getRef()));
        return b;
    } catch (MalformedURLException e) {
        return new Bundle();
    }
}

From source file:jp.mixi.android.sdk.util.UrlUtils.java

/**
 * ?Bundle???/*from  w  ww  . jav a2s.c o m*/
 * 
 * @param data ?
 * @return Bundle
 */
private static Bundle decodeUrl(String data) {
    Bundle bundle = new Bundle();
    if (data != null) {
        String[] array = data.split(PARAM_SEPARATOR);
        for (String parameter : array) {
            String[] vals = parameter.split(EQUAL);
            if (vals.length == 2) {
                try {
                    bundle.putString(URLDecoder.decode(vals[0], HTTP.UTF_8),
                            URLDecoder.decode(vals[1], HTTP.UTF_8));
                } catch (UnsupportedEncodingException e) {
                    Log.e(TAG, e.getLocalizedMessage(), e);
                }
            }
        }
    }

    return bundle;
}

From source file:org.ale.scanner.zotero.web.worldcat.WorldCatAPIClient.java

public void issnLookup(String issn) {
    APIRequest r = newRequest();//from w  w w.j  a va 2s .c o m
    r.setHttpMethod(APIRequest.GET);
    r.setURI(URI.create(String.format(XISSN_SEARCH, issn)));
    Bundle extra = new Bundle();
    extra.putString(WorldCatAPIClient.EXTRA_ISBN, issn);
    r.setExtra(extra);

    mRequestQueue.enqueue(r);
}

From source file:com.manning.androidhacks.hack023.authenticator.Authenticator.java

@Override
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType,
        String[] requiredFeatures, Bundle options) throws NetworkErrorException {

    final Intent intent = new Intent(mContext, AuthenticatorActivity.class);
    intent.putExtra(AuthenticatorActivity.PARAM_AUTHTOKEN_TYPE, authTokenType);
    intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
    final Bundle bundle = new Bundle();
    bundle.putParcelable(AccountManager.KEY_INTENT, intent);

    return bundle;

}