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.share.internal.WebDialogParameters.java

public static Bundle create(ShareLinkContent shareLinkContent) {
    Bundle params = new Bundle();
    Utility.putUri(params, ShareConstants.WEB_DIALOG_PARAM_HREF, shareLinkContent.getContentUrl());

    return params;
}

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

@Override
protected void onPostExecute(Void result) {
    try {/* w w w.  j  a v a  2s  . com*/
        mProgressDialog.dismiss();
        mProgressDialog = null;
    } catch (Exception e) {
        Log.w(TAG, e.getMessage());
    }

    Bundle args = new Bundle();
    args.putString("link", HtmlFormUtils.getResponseUrl());
    args.putString("title", subject);
    args.putString("page", "1");

    // Create new fragment and transaction
    Fragment newFragment = ThreadFragment.newInstance();

    FragmentUtils.fragmentTransaction(sourceFragment.getActivity(), newFragment, true, true, args);
}

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

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

    mHandler = new Handler();

    setContentView(R.layout.update_post_response);
    LayoutParams params = getWindow().getAttributes();
    params.width = LayoutParams.FILL_PARENT;
    params.height = LayoutParams.FILL_PARENT;
    getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);

    mOutput = (TextView) findViewById(R.id.apiOutput);
    mOutput.setText(values.toString());//from www .j  a  v a  2s  .  co m

    mUsefulTip = (TextView) findViewById(R.id.usefulTip);
    mUsefulTip.setMovementMethod(LinkMovementMethod.getInstance());
    mViewPostButton = (Button) findViewById(R.id.view_post_button);
    mDeletePostButton = (Button) findViewById(R.id.delete_post_button);
    final String postId = values.getString("post_id");

    mViewPostButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            /*
             * Source tag: view_post_tag
             */
            Utility.mAsyncRunner.request(postId, new WallPostRequestListener());
        }
    });
    mDeletePostButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            /*
             * Source tag: delete_post_tag
             */
            Utility.mAsyncRunner.request(postId, new Bundle(), "DELETE", new WallPostDeleteListener(), null);
        }
    });
}

From source file:com.QuarkLabs.BTCeClient.fragments.OrdersBookFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mPairsSpinner = (Spinner) LayoutInflater.from(getActivity()).inflate(R.layout.spinner, null);
    mPairsSpinner.setAdapter(new ArrayAdapter<>(getActivity(), android.R.layout.simple_list_item_1,
            getResources().getStringArray(R.array.ExchangePairs)));
    //restoring spinner position
    if (savedInstanceState != null) {
        mPairsSpinner.setSelection(savedInstanceState.getInt("position"));
    }//from   www  . java 2 s  . co  m
    mPairsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override
        public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
            String selected = parent.getSelectedItem().toString();
            Bundle bundle = new Bundle();
            bundle.putString("pair", selected);
            if (mFragmentOpenedFirstTime) {
                getLoaderManager().initLoader(LOADER_ID, bundle, OrdersBookFragment.this);
                mFragmentOpenedFirstTime = false;
            } else {
                getLoaderManager().restartLoader(LOADER_ID, bundle, OrdersBookFragment.this);
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> parent) {

        }
    });

    mAsksAdapter = new OrdersBookAdapter(getActivity());
    mBidsAdapter = new OrdersBookAdapter(getActivity());
}

From source file:com.brodev.socialapp.view.BlogDetail.java

/** Called when the activity is first created. */
@Override/*  w  w w  . j a  va  2s. co m*/
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.blog_content_view);

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    Bundle bundle = getIntent().getExtras();
    blog = (Blog) bundle.get("blog");

    user = (User) getApplicationContext();
    colorView = new ColorView(getApplicationContext());
    this.imageGetter = new ImageGetter(getApplicationContext());

    if (android.os.Build.VERSION.SDK_INT > 9) {
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
    }

    if (blog.getTime_stamp().equals("0")) {
        this.getBlogAdapter();
    }

    initView();
    // get comment fragment
    Bundle comment = new Bundle();
    comment.putString("type", "blog");
    comment.putInt("itemId", blog.getBlog_id());
    comment.putInt("totalComment", blog.getTotal_comment());
    comment.putInt("total_like", blog.getTotal_like());
    comment.putBoolean("no_share", blog.getShare());
    comment.putBoolean("is_liked", blog.getIs_like());
    comment.putBoolean("can_post_comment", blog.isCanPostComment());

    CommentFragment commentFragment = new CommentFragment();
    commentFragment.setArguments(comment);
    getSupportFragmentManager().beginTransaction().add(R.id.commentfragment_wrap, commentFragment).commit();
}

From source file:models.newArrivalFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_newarrival, container, false);
    getActivity().setTitle("New Arrivals!");

    //animation when enter home page
    rootView.startAnimation(AnimationUtils.loadAnimation(getActivity(), R.anim.image_click));

    //download the URL's asynchronously (put the info in the teaInfo object)
    try {//from ww w  . j ava2 s.com
        teaInfo = new GetTeaInfoTask().execute(new ApiConnector()).get();
    } catch (InterruptedException e) {
        e.printStackTrace();
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
    //make the gridview and set its adapter
    GridView gridView = (GridView) rootView.findViewById(R.id.grid_view_new_arrival);
    GridViewCustomAdapter gvAdapter = new GridViewCustomAdapter(getActivity(), teaInfo.imageURLs,
            teaInfo.teaNames);
    gridView.setAdapter(gvAdapter);

    //onclick listener for gridview
    gridView.setOnItemClickListener(new OnItemClickListener() {

        public void onItemClick(AdapterView<?> parent, View v, int position, long id) {

            Bundle teaViewArgs = new Bundle();
            teaViewArgs.putString("teaName", teaInfo.teaNames.get(position));
            teaViewArgs.putString("teaImgUrl", teaInfo.imageURLs.get(position));
            teaViewArgs.putString("teaDesc", teaInfo.teaDescriptions.get(position));
            Fragment newFragment = new TeaViewFragment();
            newFragment.setArguments(teaViewArgs);

            if (newFragment != null) {
                flipCard(newFragment);
            }
        }

        private void flipCard(Fragment newFragment) {
            mShowingBack = true;
            FragmentManager fragmentManager = getFragmentManager();
            fragmentManager.beginTransaction()
                    .setCustomAnimations(R.anim.card_flip_right_in, R.anim.card_flip_right_out,
                            R.anim.card_flip_left_in, R.anim.card_flip_left_out)
                    .replace(R.id.frame_container, newFragment).addToBackStack(null).commit(); // create new fragment and allow user to go back to previous fragment          
        }

    });

    return rootView;
}

From source file:com.rukman.emde.smsgroups.authenticator.GMSAuthenticator.java

@Override
public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType,
        Bundle options) throws NetworkErrorException {

    Log.d(TAG, "Get Auth Token");
    // If the caller requested an authToken type we don't support, then
    // return an error
    if (!authTokenType.equals(GMSApplication.AUTHTOKEN_TYPE)) {
        final Bundle result = new Bundle();
        result.putString(AccountManager.KEY_ERROR_MESSAGE, "invalid authTokenType");
        return result;
    }/*w w  w  . j  a  v  a 2s  . c om*/

    // Extract the username and password from the Account Manager, and ask
    // the server for an appropriate AuthToken.
    final String password = AccountManager.get(mContext).getPassword(account);
    if (!TextUtils.isEmpty(password)) {
        try {
            final String authToken = NetworkUtilities.authenticate(account.name, password);
            if (!TextUtils.isEmpty(authToken)) {
                final Bundle result = new Bundle();
                result.putString(AccountManager.KEY_ACCOUNT_NAME, account.name);
                result.putString(AccountManager.KEY_ACCOUNT_TYPE, GMSApplication.ACCOUNT_TYPE);
                result.putString(AccountManager.KEY_AUTHTOKEN, authToken);
                return result;
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    // If we get here, then we couldn't access the user's password - so we
    // need to re-prompt them for their credentials. We do that by creating
    // an intent to display our AuthenticatorActivity panel.
    final Intent intent = new Intent(mContext, GMSAuthenticatorActivity.class);
    intent.putExtra(GMSAuthenticatorActivity.PARAM_USERNAME, account.name);
    intent.putExtra(GMSAuthenticatorActivity.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;
}

From source file:eu.masconsult.bgbanking.accounts.AccountAuthenticator.java

@Override
public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType,
        String[] requiredFeatures, Bundle options) throws NetworkErrorException {
    Log.v(TAG, "addAccount(type: " + accountType + ", authTokenType: " + authTokenType + ")");

    final Intent intent = new Intent(context, LoginActivity.class);
    intent.putExtra(KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response);
    intent.putExtra(KEY_ACCOUNT_TYPE, accountType);
    final Bundle bundle = new Bundle();
    bundle.putParcelable(KEY_INTENT, intent);
    return bundle;
}

From source file:com.sunho.nating.fragments.DetailUnivFragment.java

/**
 * Create a new instance of DetailFragment.
 *
 * @param resourceId The resource ID of the Drawable image to show
 * @param title The title of the image/*from   ww w  .  ja v  a 2  s  .  co m*/
 * @param x The horizontal position of the grid item in pixel
 * @param y The vertical position of the grid item in pixel
 * @param width The width of the grid item in pixel
 * @param height The height of the grid item in pixel
 * @return a new instance of DetailFragment
 */
public static DetailUnivFragment newInstance(int resourceId, String title, int x, int y, int width, int height,
        int position, String locationLat, String locationLong) {
    myLocationLat = locationLat;
    myLocationLong = locationLong;
    intentPosition = position;
    DetailUnivFragment fragment = new DetailUnivFragment();
    Bundle args = new Bundle();
    args.putInt(ARG_RESOURCE_ID, resourceId);
    args.putString(ARG_TITLE, title);
    args.putInt(ARG_X, x);
    args.putInt(ARG_Y, y);
    args.putInt(ARG_WIDTH, width);
    args.putInt(ARG_HEIGHT, height);
    fragment.setArguments(args);
    return fragment;
}

From source file:de.wikilab.android.friendica01.FileUploadService.java

private void showFailMsg(Context ctx, String txt) {
    NotificationManager mNotificationManager = (NotificationManager) getSystemService(
            Context.NOTIFICATION_SERVICE);

    Log.e("Andfrnd/UploadFile", "Upload FAILED: " + txt);

    //Instantiate the Notification:
    CharSequence tickerText = "Upload failed, please retry!";
    Notification notification = new Notification(R.drawable.arrow_up, tickerText, System.currentTimeMillis());
    notification.flags |= Notification.FLAG_AUTO_CANCEL;

    //Define the Notification's expanded message and Intent:
    Context context = getApplicationContext();
    CharSequence contentTitle = "Upload failed, click to retry!";
    CharSequence contentText = txt;
    Intent notificationIntent = new Intent(this, FriendicaImgUploadActivity.class);
    Bundle b = new Bundle();
    b.putParcelable(Intent.EXTRA_STREAM, fileToUpload);
    b.putString(Intent.EXTRA_SUBJECT, subject);
    b.putString(EXTRA_DESCTEXT, descText);

    notificationIntent.putExtras(b);/* ww  w .j a  v  a 2s  . c  o m*/
    PendingIntent contentIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);
    notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);

    //Pass the Notification to the NotificationManager:
    mNotificationManager.notify(UPLOAD_FAILED_ID, notification);
    //Toast.makeText(ctx, "Upload failed, please retry:\n" + txt, Toast.LENGTH_LONG).show();
}