Example usage for android.os Bundle getLong

List of usage examples for android.os Bundle getLong

Introduction

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

Prototype

public long getLong(String key, long defaultValue) 

Source Link

Document

Returns the value associated with the given key, or defaultValue if no mapping of the desired type exists for the given key.

Usage

From source file:com.sweetiepiggy.littlepro.BrowseSubjectsActivity.java

private void loadState(Bundle bundle) {
    mEmail = bundle.getString("email");
    mCourseId = bundle.getLong("courseId", -1);
}

From source file:de.vanita5.twittnuker.fragment.support.SavedSearchesListFragment.java

@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    mAdapter = new SavedSearchesAdapter(getActivity());
    setListAdapter(mAdapter);//from w  w  w.  ja v  a2 s  .  c o m
    mListView = getListView();
    mListView.setOnItemLongClickListener(this);
    final Bundle args = getArguments();
    mAccountId = args != null ? args.getLong(EXTRA_ACCOUNT_ID, -1) : -1;
    getLoaderManager().initLoader(0, null, this);
    setListShown(false);
}

From source file:com.sweetiepiggy.littlepro.BrowseQuizzesActivity.java

private void loadState(Bundle bundle) {
    mEmail = bundle.getString("email");
    mCourseId = bundle.getLong("courseId", -1);
    mSubjectId = bundle.getLong("subjectId", -1);
}

From source file:de.vanita5.twittnuker.fragment.support.ActivitiesAboutMeFragment.java

@Override
protected String[] getSavedActivitiesFileArgs() {
    final Bundle args = getArguments();
    if (args != null && args.containsKey(EXTRA_ACCOUNT_ID)) {
        final long account_id = args.getLong(EXTRA_ACCOUNT_ID, -1);
        return new String[] { AUTHORITY_ACTIVITIES_ABOUT_ME, "account" + account_id };
    }/*from  ww  w.  j  a  v a  2  s  .  c om*/
    return new String[] { AUTHORITY_ACTIVITIES_ABOUT_ME };
}

From source file:de.vanita5.twittnuker.fragment.support.ActivitiesByFriendsFragment.java

@Override
protected String[] getSavedActivitiesFileArgs() {
    final Bundle args = getArguments();
    if (args != null && args.containsKey(EXTRA_ACCOUNT_ID)) {
        final long account_id = args.getLong(EXTRA_ACCOUNT_ID, -1);
        return new String[] { AUTHORITY_ACTIVITIES_BY_FRIENDS, "account" + account_id };
    }// w  ww .j  a  va  2s .  c  om
    return new String[] { AUTHORITY_ACTIVITIES_BY_FRIENDS };
}

From source file:de.vanita5.twittnuker.fragment.support.SetUserNicknameDialogFragment.java

@Override
public void onClick(final DialogInterface dialog, final int which) {
    final Bundle args = getArguments();
    final String text = ParseUtils.parseString(mEditText.getText());
    final long userId = args != null ? args.getLong(EXTRA_USER_ID, -1) : -1;
    if (userId == -1)
        return;//  ww w . jav  a2s  . c om
    switch (which) {
    case DialogInterface.BUTTON_POSITIVE: {
        if (TextUtils.isEmpty(text)) {
            clearUserNickname(getActivity(), userId);
        } else {
            setUserNickname(getActivity(), userId, text);
        }
        break;
    }
    case DialogInterface.BUTTON_NEUTRAL: {
        clearUserNickname(getActivity(), userId);
        break;
    }
    }

}

From source file:com.sweetiepiggy.littlepro.SubmitQuizFragment.java

private void loadState(Bundle bundle) {
    mEmail = bundle.getString(ARG_EMAIL);
    mCourseId = bundle.getLong("courseId", -1);
    mSubjectId = bundle.getLong("subjectId", -1);
    mQuizId = bundle.getLong("quizId", -1);
    mSubmitted = bundle.getBoolean("submitted", false);
}

From source file:com.sweetiepiggy.littlepro.QuizActivity.java

private void loadState(Bundle bundle) {
    mEmail = bundle.getString("email");
    mCourseId = bundle.getLong("courseId", -1);
    mSubjectId = bundle.getLong("subjectId", -1);
    mQuizId = bundle.getLong("quizId", -1);
    mSubmitted = bundle.getBoolean("submitted", false);
}

From source file:com.fullmeadalchemist.mustwatch.ui.log.form.LogFormFragment.java

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    viewModel = ViewModelProviders.of(this, viewModelFactory).get(LogFormViewModel.class);

    Bundle bundle = this.getArguments();
    long batchId = bundle.getLong(BATCH_ID, Long.MIN_VALUE);
    if (batchId != Long.MIN_VALUE) {
        viewModel.logEntry.batchId = batchId;
        this.batchId = batchId;
        Log.i(TAG, String.format("Created LogEntry with Batch ID %d", batchId));

    } else {//from w w  w.  j  a  v a 2 s .co m
        Log.e(TAG, "No Batch ID was received. Redirecting back to Batch list.");
        navigationController.navigateToBatches();
    }

    updateUiDateTime();
    initClickListeners();
    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(datePickerMessageReceiver,
            new IntentFilter(DATE_SET_EVENT));
    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(timePickerMessageReceiver,
            new IntentFilter(TIME_SET_EVENT));
}

From source file:com.fullmeadalchemist.mustwatch.ui.recipe.detail.RecipeDetailFragment.java

@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    initClickListeners();/*from  www.j av a2  s. com*/

    Bundle bundle = this.getArguments();
    if (bundle != null) {
        long recipeId = bundle.getLong(RECIPE_ID, Long.MIN_VALUE);
        Timber.v("Got Recipe ID %d from the NavigationController.", recipeId);

        if (recipeId != Long.MIN_VALUE) {
            if (viewModel.recipe != null) {
                Timber.v("Reusing viewmodel data");
                dataBinding.setRecipe(viewModel.recipe);
                updateRecipeUiInfo();
                updateRecipeIngredientUiInfo();
            } else {
                Timber.v("Going to the RecipeRepository to get the Recipe with id %s", recipeId);
                viewModel.getRecipe(recipeId).observe(this, recipe -> {
                    if (recipe != null) {
                        Timber.v("Loaded Recipe with ID %d:\n%s", recipe.id, recipe);

                        viewModel.recipe = recipe;
                        dataBinding.setRecipe(viewModel.recipe);
                        updateRecipeUiInfo();

                        viewModel.getRecipeIngredients(recipeId).observe(this, recipeIngredients -> {
                            if (recipeIngredients != null) {
                                Timber.v("Loaded %s Recipe ingredients", recipeIngredients.size());
                                viewModel.recipe.ingredients = recipeIngredients;
                                updateRecipeIngredientUiInfo();
                            } else {
                                Timber.w(
                                        "Received nothing from the RecipeRepository when trying to get ingredients for Recipe %s",
                                        recipeId);
                            }
                        });

                    } else {
                        Timber.w("Received a null Batch from the RecipeDetailViewModel.");
                    }
                });
            }
        }
    } else {
        Timber.i("No Recipe ID was received. Redirecting to the Batch Creation form.");
        navigationController.navigateToAddBatch();
    }
}