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:de.aw.awlib.fragments.AWRemoteFileChooser.java

/**
 * Erstellt eine neue Instanz eines FileChooser, zeigt die Daten des uebergebenen
 * Verzeichnisnamen an//from  w  w w  .  j a  v a 2 s  .c o  m
 *
 * @return Fragment
 *
 * @throws IllegalStateException
 *         wenn das Verzeichnis kein Directory ist
 */
public static AWRemoteFileChooser newInstance(AWRemoteFileServer fileServer) {
    Bundle args = new Bundle();
    AWRemoteFileChooser fragment = new AWRemoteFileChooser();
    args.putParcelable(REMOTEFILESERVER, fileServer);
    fragment.setArguments(args);
    return fragment;
}

From source file:com.silentcircle.silenttext.activity.AccountCreationActivity.java

private static Bundle toBundle(Intent intent) {
    Bundle bundle = new Bundle();
    if (intent != null) {
        copyCharSequence(intent, bundle, AccountCreationFragment.EXTRA_USERNAME);
        copyCharSequence(intent, bundle, AccountCreationFragment.EXTRA_PASSWORD);
        copyCharSequence(intent, bundle, AccountCreationFragment.EXTRA_EMAIL);
        copyCharSequence(intent, bundle, AccountCreationFragment.EXTRA_FIRST_NAME);
        copyCharSequence(intent, bundle, AccountCreationFragment.EXTRA_LAST_NAME);
        copyCharSequence(intent, bundle, AccountCreationFragment.EXTRA_LICENSE_CODE);
    }/*from w w w  . j a v  a 2s . c  om*/
    return bundle;
}

From source file:com.amazon.adobepass.auth.AdobepassAuthentication.java

/**
 * Verifies if the user is logged in with Adobepass.
 * The API internally takes care of retrying failed calls
 *
 * @param context         The context to check if user is logged in.
 * @param responseHandler The callback listener for output of this web service request.
 *///  w w  w. j  ava2  s .co  m
@Override
public void isUserLoggedIn(Context context, final ResponseHandler responseHandler) {

    final Bundle bundle = new Bundle();
    try {
        if (NetworkUtils.isConnectedToNetwork(context)) {
            AdobepassRestClient.getAuthenticationTokenRequest(context, new JsonHttpResponseHandler() {
                @Override
                public void onSuccess(int statusCode, Header[] headers, JSONObject response) {

                    super.onSuccess(statusCode, headers, response);
                    Log.i(TAG, "getAuthenticationTokenRequest succeeded");
                    responseHandler.onSuccess(bundle);
                }

                @Override
                public void onFailure(int statusCode, Header[] headers, Throwable throwable,
                        JSONObject errorResponse) {

                    super.onFailure(statusCode, headers, throwable, errorResponse);
                    Log.e(TAG, "User is not logged in. Status code: " + statusCode + " ErrorResponse"
                            + errorResponse, throwable);
                    populateAuthenticationFailureBundle(statusCode, bundle, throwable);
                    responseHandler.onFailure(bundle);
                }

                @Override
                public void onFailure(int statusCode, Header[] headers, String responseString,
                        Throwable throwable) {

                    super.onFailure(statusCode, headers, responseString, throwable);
                    Log.e(TAG, "User is not logged in. Status code: " + statusCode + " ErrorResponse"
                            + responseString, throwable);
                    populateAuthenticationFailureBundle(statusCode, bundle, throwable);
                    responseHandler.onFailure(bundle);
                }

            });
        } else {
            bundle.putString(AuthenticationConstants.ERROR_CATEGORY,
                    AuthenticationConstants.NETWORK_ERROR_CATEGORY);
            responseHandler.onFailure(bundle);
        }
    } catch (Resources.NotFoundException e) {
        Log.e(TAG, "There was an exception when generating the authorization request. ", e);
        responseHandler.onFailure(bundle);
    } catch (Exception e) {
        Log.e(TAG, "There was an exception when generating the authentication token request.", e);
        responseHandler.onFailure(bundle);
    }
}

From source file:com.cssweb.android.quote.QHHQActivity.java

private void loadAllStock(final int position) {
    Intent localIntent = new Intent();
    if (position == 0) {
        localIntent.setClass(QHHQActivity.this, ZJS.class);
        Bundle extras = new Bundle();
        extras.putInt("stocktype", 201);
        extras.putString("market", "cffex");
        extras.putString("exchange", "cf");
        extras.putString("title", "");
        localIntent.putExtras(extras);/* w  w w .j  av  a 2 s. c  om*/

    } else if (position == 1) {
        localIntent.setClass(QHHQActivity.this, SQS.class);

        Bundle extras = new Bundle();
        extras.putInt("stocktype", 201);
        extras.putString("market", "sfe");
        extras.putString("exchange", "sf");
        extras.putString("title", "");
        extras.putInt("type", R.array.sqs_type_menu);
        localIntent.putExtras(extras);
    } else if (position == 2) {
        localIntent.setClass(QHHQActivity.this, DSS.class);

        Bundle extras = new Bundle();
        extras.putInt("stocktype", 201);
        extras.putString("market", "dce");
        extras.putString("exchange", "dc");
        extras.putString("title", "");
        extras.putInt("type", R.array.dss_type_menu);
        localIntent.putExtras(extras);
    } else if (position == 3) {
        localIntent.setClass(QHHQActivity.this, ZSS.class);

        Bundle extras = new Bundle();
        extras.putInt("stocktype", 201);
        extras.putString("market", "czce");
        extras.putString("exchange", "cz");
        extras.putString("title", "");
        extras.putInt("type", R.array.zss_type_menu);
        localIntent.putExtras(extras);
    } else if (position == 4) {
        localIntent.setClass(QHHQActivity.this, QQSP.class);
    }
    startActivity(localIntent);
}

From source file:com.gmail.at.faint545.services.DataQueueService.java

@Override
protected void onHandleIntent(Intent intent) {
    String url = intent.getStringExtra("url");
    String api = intent.getStringExtra("api");
    StringBuilder results = new StringBuilder();

    HttpClient client = new DefaultHttpClient();
    HttpPost request = new HttpPost(url);

    ArrayList<NameValuePair> arguments = new ArrayList<NameValuePair>();
    arguments.add(new BasicNameValuePair(SabnzbdConstants.APIKEY, api));
    arguments.add(new BasicNameValuePair(SabnzbdConstants.OUTPUT, SabnzbdConstants.OUTPUT_JSON));
    arguments.add(new BasicNameValuePair(SabnzbdConstants.MODE, SabnzbdConstants.MODE_QUEUE));

    try {// w ww.  j ava2 s .c  o m
        request.setEntity(new UrlEncodedFormEntity(arguments));
        HttpResponse result = client.execute(request);
        InputStream inStream = result.getEntity().getContent();
        BufferedReader br = new BufferedReader(new InputStreamReader(inStream), 8);
        String line;
        while ((line = br.readLine()) != null) {
            if (line.length() > 0) {
                results.append(line);
            }
        }
        br.close();
        inStream.close();

        Bundle extras = intent.getExtras();
        Messenger messenger = (Messenger) extras.get("messenger");
        Message message = Message.obtain();

        Bundle resultsBundle = new Bundle();
        resultsBundle.putString("results", results.toString());
        message.setData(resultsBundle);

        messenger.send(message);
        stopSelf();
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (RemoteException e) {
        e.printStackTrace();
    }
}

From source file:edu.cwru.apo.APO.java

public void onRestRequestComplete(API.Methods method, JSONObject result) {
    // check and see if the splash screen has been shown for the minimum amount of time
    // NOTE: This would probably be better done with a timer.  Need to change this
    while (Auth.getTimestamp() - STARTTIME < SPLASHTIME) {
        // do nothing.  This is probably not the right way to do this
    }//from w w  w.  j a v a 2 s.c om

    // set the next activity to default Login
    Intent nextActivity = new Intent(APO.this, Login.class);
    Bundle extras = new Bundle();

    if (method == Methods.checkCredentials) {
        if (result != null) {
            try {
                if (result.getString("requestStatus").compareTo("valid") == 0) {
                    //change the nextActivity to Home
                    Auth.loggedIn = true;
                    nextActivity = new Intent(APO.this, Home.class);
                } else if (result.getString("requestStatus").compareTo("No response") == 0) {
                    extras.putString("msg", "Could not contact web server. Please check your connection");
                } else {
                    extras.putString("msg", "Invalid credentials");
                }

            } catch (JSONException e) {
                extras.putString("msg", "JSON error: Invalid JSON response");
                e.printStackTrace();
            }
        } else {
            extras.putString("msg", "JSON error: No JSON Object to read");
        }
    } else {
        extras.putString("msg", "Invalid method called");
    }

    nextActivity.putExtras(extras);

    // start the next activity
    APO.this.startActivity(nextActivity);
    finish();
}

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

public void dispatchEvents(String eventName, String eventData) {
    Bundle data = new Bundle();
    data.putString("eventName", eventName);
    data.putString("eventData", eventData);
    data.putString("channelName", mName);
    Message msg = Message.obtain();//  www.j  a va  2  s. co m
    msg.setData(data);

    for (PusherCallback callback : mGlobalCallbacks) {
        callback.sendMessage(msg);
    }

    /* do we have a callback bound to that event? */
    if (mLocalCallbacks.containsKey(eventName)) {
        /* execute each callback */
        for (PusherCallback callback : mLocalCallbacks.get(eventName)) {
            callback.sendMessage(msg);
        }
    }

}

From source file:com.familygraph.android.Util.java

/**
 * Parse a URL query and fragment parameters into a key-value bundle.
 * /*from  w w  w  .  j ava2  s. c o  m*/
 * @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("fgconnect", "http");
    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:com.brennasoft.facebookdashclockextension.fbclient.NotificationsRequest.java

public NotificationsResponse executeWithApplicationFilter(Session session, Set<String> applicationTypes) {
    NotificationsResponse notificationsResponse = null;
    if (session.isOpened()) {
        Bundle parameters = new Bundle();
        parameters.putString("q",
                q + " and app_id in " + applicationTypes.toString().replace('[', '(').replace(']', ')'));
        Request request = new Request(session, "/fql", parameters, HttpMethod.GET);
        Response response = request.executeAndWait();
        FacebookRequestError error = response.getError();
        if (error == null) {
            notificationsResponse = parseResponse(response);
        } else {/*w  w w  .  j a v a2 s  .co  m*/
            notificationsResponse = new NotificationsResponse();
        }
    }
    return notificationsResponse;
}