Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9192179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:51:39+00:00 2026-06-17T20:51:39+00:00

I have a problem with getting something from the previous activity of my application.

  • 0

I have a problem with getting something from the previous activity of my application. My case is, the previous activity, known as ListOfMeals, it has a listview (breakfast, morning snack, etc.) If I’d click breakfast and add meal, I’d click for list of foods like bread, fruits, veggies, etc. After that, it should add to my database. But what I have so far is this, please refer below:

case R.id.btFoodVegetableSave:
        String mealname = selected;

        String serving = calories.getText().toString();
        int i = Integer.parseInt(serving.replaceAll("[\\D]", ""));

        String servng = String.valueOf(i);

        SimpleDateFormat sdf = new SimpleDateFormat("MM-dd-yyyy");
        String strDate = sdf.format(new Date());

        if ( ( mealname.isEmpty() || servng.isEmpty() ) ){

            // call for custom toast
            viewErrorToast();
        }

        else {

        boolean didItWork = true;

        try{

            BreakFastLog entry = new BreakFastLog(Baguettes_Bagels.this);
            entry.open();   
            entry.createEntry(mealname, servng, strDate);
            entry.close();

            }
            catch(Exception e){
                didItWork = false;
                viewErrorToast();
            }finally{
                if (didItWork){
                    viewBMRSavedToast();
                }

            }
        } // end of if else statement
        break;

In my example, it only saves to my breakfast. But problem rises here when I’d choose morning snack not the breakfast. How can I get what the user selected from a previous activity and save it to its respective meal?

I know this has got something to do with this:

BreakFastLog entry = new BreakFastLog(Baguettes_Bagels.this);
        entry.open();   
        entry.createEntry(mealname, servng, strDate);
        entry.close();

I have to put if else statement, but I can’t think of some clever ways to implement this. Thanks for your help in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:51:40+00:00Added an answer on June 17, 2026 at 8:51 pm

    When you start the activity you have probable something like:

    Intent intent = new Intent(...);
    startActivity(intent);
    

    You can add:

    intent.putExtra(key, yourparameter);
    

    And when your second activity starts you can retreive it with in the onCreate for example:

    int value = getIntent().getExtras().getInt(key);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with getting jquery to retrieve results from a WCF service.
i have a problem with getting content from a XML into a mysql database.
I have problem with getting value from binary registry key. My code so far
I have a problem getting results from the following query: SELECT SQL_CALC_FOUND_ROWS App.ID, UserFeedback.Type
I have a problem in getting some data out from Cassandra using c# and
I have a problem getting my data from database and foreach it. This is
THIS IS THE CONTINUATION OF MY QUESTION: I have a problem with getting something
I have a problem getting result from a database by specific column value using
I just started a graphical C++ course and I have problem getting an overview
I have a problem getting password_Reset_confirm bit working. url: (r'^password_reset/$', 'django.contrib.auth.views.password_reset'), (r'^password_reset_done/$', 'django.contrib.auth.views.password_reset_done'), (r'^password_reset_confirm/(?P<uidb36>[0-9A-Za-z]+)-(?P<token>.+)/$',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.