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 6746095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:16:57+00:00 2026-05-26T12:16:57+00:00

As the title says I want to transfer data, in this case the information

  • 0

As the title says I want to transfer data, in this case the information introduced by the user on an EditText and a Spinner, from one activity to another.

I am following a tutorial from a book but it doesn’t work (I think its not complete). Here the code of the program:

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.main);
    this.location=(EditText)findViewById(R.id.location);
    this.cuisine=(Spinner)findViewById(R.id.cuisine);
    this.grabReviews=(Button)findViewById(R.id.get_reviews_button);

    ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.cuisine, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

    this.cuisine.setAdapter(adapter);
    this.grabReviews.setOnClickListener(new OnClickListener()
        {
            public void onClick(View v)
            {
                handleGetReviews();
            }
        }
    );
}

private void handleGetReviews() {

    RestaurantsActivity application= (RestaurantsActivity) getApplication();
    application.setReviewCriteriaCuisine(this.cuisine.getSelectedItem().toString());
    application.setReviewCriteriaLocation(this.location.getText().toString());
    Intent intent=new Intent(Constants.INTENT_ACTION_VIEW_LIST);
    startActivity(intent);

}

This code above doesn’t work. I dont understand four things:

–RestaurantsActivity must be the actual activity right?

-In all the examples I have seen over the internet there is an application extends class, in this example there isnt.

–setReviewCriteria function is missing

-Where does Constants.INTENT_ACTION_VIEW_LIST come from ?

  • 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-05-26T12:16:58+00:00Added an answer on May 26, 2026 at 12:16 pm

    So your target is to get the data to Restaurantsactivity?
    Normally data in android are handed over from one activtiy to another by using Intents.

    So first you create an intent.
    Then you put the data you want to transfer into the intent by using the intent.putExtra() method.
    In the activity that gets the intent you can get the data by using getIntent().getExtra() method (getExtra can be something like getStringExtra()).

    Here is a small example for a edit box called “name”:

    public void onCreate(Bundle iBundle){
      //do some stuff here
      //perhaps define some Buttos and so on
    
      //now lets start the activity
      Intent intent = new Intent(currentActivityname.this, ActivityYouWantToStart.class);
      intent.putExtra("name", name.getText().toString())
      startActivity(intent); // you can also start an startActivityForResult() here :)
    }
    

    In our receiving activity you can now handle the intent (e.g. in the onCreate() method

    public void onCreate(Bundle iBundle){
    String name = this.getIntent().getStringExtra("name",some default value);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So as the title says i want to prevent user from keep submiting $_POST
As the title says, i want to retrieve my Json data values from a
As the title says, I want to output 2 .msi files from one project
As the title says really. I want to enable sharing user generated content easily
As the title says i want to call a mixed mode assembly from unmanaged
As the title says I want to remove the first 4 letters from a
i want to do what the title says like this: int number1; cin>>number1; num1len=log10(number1)+1;
As the title says, I know what causes this error but I want to
As topic's title says I want to do something when user touches UITextField and
As the title says, then I want to access x. from a let instead

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.