Example usage for android.os Bundle putLong

List of usage examples for android.os Bundle putLong

Introduction

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

Prototype

public void putLong(@Nullable String key, long value) 

Source Link

Document

Inserts a long value into the mapping of this Bundle, replacing any existing value for the given key.

Usage

From source file:com.rowland.movies.ui.activities.DetailActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Inflate the layout
    setContentView(R.layout.activity_detail);
    // Inject all the views
    ButterKnife.bind(this);
    // Check that the activity is using the layout with the fragment_container id
    if (findViewById(R.id.detail_container) != null) {
        // However, if we're being restored from a previous state,
        // then we don't need to do anything and should return or else
        // we could end up with overlapping fragments.
        if (savedInstanceState != null) {
            return;
        }/*from  w ww . j  a  v a  2s.  co m*/
        // Create the detail fragment and add it to the activity
        // using a fragment transaction.
        else {
            long movieId = getIntent().getLongExtra(DetailFragment.MOVIE_KEY, 0);
            // Create a Bundle object
            Bundle args = new Bundle();
            // Set arguments on Bundle
            args.putLong(DetailFragment.MOVIE_KEY, movieId);
            // Pass bundle to the fragment
            showDetailFragment(args);
        }
    }

}

From source file:cl.ipp.katbag.fragment.Board.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    v = inflater.inflate(R.layout.fragment_board, container, false);
    mainActivity = (MainActivity) super.getActivity();

    notRegister = (TextView) v.findViewById(R.id.board_not_register);

    boardListView = (DragSortListView) v.findViewById(R.id.board_list_view);
    boardListView.setOnItemClickListener(new OnItemClickListener() {
        @Override// w w w.  j  a v a  2s.  com
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            TextView idApp = (TextView) view.findViewById(R.id.board_row_id);
            TextView typeApp = (TextView) view.findViewById(R.id.board_row_type);
            TextView nameApp = (TextView) view.findViewById(R.id.board_row_name);

            if (typeApp.getText().toString().contentEquals(MainActivity.TYPE_APP_GAME))
                mFragment = new Player();
            else
                mFragment = new PlayerBook();

            Bundle bundle = new Bundle();
            bundle.putLong("id_app", Long.parseLong(idApp.getText().toString()));
            bundle.putString("name_app", nameApp.getText().toString());
            bundle.putString("type_app", typeApp.getText().toString());
            bundle.putBoolean("editMode", false);

            mFragment.setArguments(bundle);
            FragmentTransaction t = getActivity().getSupportFragmentManager().beginTransaction();
            t.replace(R.id.fragment_main_container, mFragment);
            t.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
            t.addToBackStack(mFragment.getClass().getSimpleName());
            t.commit();
        }
    });

    return v;
}

From source file:amhamogus.com.daysoff.CalendarActivity.java

public void onCalendarSelected(Date date, EventCollection eventCollection) {

    Bundle bundle = new Bundle();
    bundle.putLong(ARG_CURRENT_DATE, date.getTime());

    SharedPreferences.Editor editor = settings.edit();
    editor.putLong(PREF_SELECTED_DATE, date.getTime());
    editor.commit();/*from   w ww.j  a v a  2  s .  c  om*/

    Intent intent = new Intent(getApplicationContext(), EventsActivity.class);
    intent.putExtras(bundle);
    startActivity(intent);
}

From source file:com.dycody.android.idealnote.utils.date.ReminderPickers.java

/**
 * Shows fallback date and time pickers for smaller screens
 */// w  w w .j  a v a 2 s  .  c  om

public void showDatePickerDialog(long presetDateTime) {
    Bundle b = new Bundle();
    b.putLong(DatePickerDialogFragment.DEFAULT_DATE, presetDateTime);
    DialogFragment picker = new DatePickerDialogFragment();
    picker.setArguments(b);
    picker.show(mActivity.getSupportFragmentManager(), Constants.TAG);
}

From source file:com.dycody.android.idealnote.utils.date.ReminderPickers.java

private void showTimePickerDialog(long presetDateTime) {
    TimePickerFragment newFragment = new TimePickerFragment();
    Bundle bundle = new Bundle();
    bundle.putLong(TimePickerFragment.DEFAULT_TIME, presetDateTime);
    newFragment.setArguments(bundle);/*  w w w.  j  a  v  a 2s .  c om*/
    newFragment.show(mActivity.getSupportFragmentManager(), Constants.TAG);
}

From source file:com.fullmeadalchemist.mustwatch.ui.common.NavigationController.java

public void navigateToEditBatch(long batchId) {
    String tag = "batch/edit/" + batchId;
    BatchFormFragment batchesFragment = new BatchFormFragment();
    Bundle data = new Bundle();
    data.putLong(BATCH_ID, batchId);
    batchesFragment.setArguments(data);// w w w.  j  a  v  a 2s.  c  o m
    Log.i(TAG, String.format("Navigating to path: %s", tag));
    fragmentManager.beginTransaction().replace(containerId, batchesFragment, tag).addToBackStack(tag)
            .commitAllowingStateLoss();
}

From source file:com.fullmeadalchemist.mustwatch.ui.common.NavigationController.java

public void navigateToBatchDetail(Long batchId) {
    String tag = "batch/view/" + batchId;
    BatchDetailFragment batchesFragment = new BatchDetailFragment();
    Bundle data = new Bundle();
    data.putLong(BATCH_ID, batchId);
    batchesFragment.setArguments(data);/*from   w w w .j a  v  a  2 s  .  c  om*/
    Log.i(TAG, String.format("Navigating to path: %s", tag));
    fragmentManager.beginTransaction().replace(containerId, batchesFragment, tag).addToBackStack(tag)
            .commitAllowingStateLoss();
}

From source file:com.fullmeadalchemist.mustwatch.ui.common.NavigationController.java

public void navigateToAddLog(Long batchId) {
    String tag = "batch/" + batchId + "/log/add";
    LogFormFragment logFormFragment = new LogFormFragment();
    Bundle data = new Bundle();
    data.putLong(BATCH_ID, batchId);
    logFormFragment.setArguments(data);//from   www  .  j a v a2  s  .  co m
    Log.i(TAG, String.format("Navigating to path: %s", tag));
    fragmentManager.beginTransaction().replace(containerId, logFormFragment, tag).addToBackStack(tag)
            .commitAllowingStateLoss();
}

From source file:com.fullmeadalchemist.mustwatch.ui.common.NavigationController.java

public void navigateToRecipeDetail(Long recipeId) {
    String tag = "recipe/view/" + recipeId;
    RecipeDetailFragment recipesFragment = new RecipeDetailFragment();
    Bundle data = new Bundle();
    data.putLong(RECIPE_ID, recipeId);
    recipesFragment.setArguments(data);//from   w  w  w.  ja  va2  s  .c  o m
    Log.i(TAG, String.format("Navigating to path: %s", tag));
    fragmentManager.beginTransaction().replace(containerId, recipesFragment, tag).addToBackStack(tag)
            .commitAllowingStateLoss();
}

From source file:com.fullmeadalchemist.mustwatch.ui.common.NavigationController.java

public void navigateToCreateFromBatch(Long recipeId) {
    String tag = "batch/add";
    BatchFormFragment batchesFragment = new BatchFormFragment();
    Bundle data = new Bundle();
    data.putLong(RECIPE_ID, recipeId);
    batchesFragment.setArguments(data);//from w w w  . ja  va2s  .  c  o m
    Log.i(TAG, String.format("Navigating to path: %s", tag));
    fragmentManager.beginTransaction().replace(containerId, batchesFragment, tag).addToBackStack(tag)
            .commitAllowingStateLoss();
}