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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:56:42+00:00 2026-06-11T03:56:42+00:00

Im working on my level-selector activity right now and I want to get the

  • 0

Im working on my level-selector activity right now and I want to get the result from wich level I chose in my MainGameView, that is run by another activity. How would I go about doing this?

This is what Ive for when you choose level 1:

     Button test1 = (Button)findViewById(R.id.test1);
     test1.setOnClickListener(new OnClickListener() {

       public void onClick(View v) {
            setLevel(1);
            Intent start = new Intent("nielsen.happy.activities.HAPPYACTIVITY");
            startActivityForResult(start, getLevel());
            finish();
        }
    });

but where do I go from here? How do I get this value into my view so I can change bitmaps and other values depending on what level they chose? Is there something I need to do in my "HappyActivity"(MainGameAcitvity) to get the result? cus right now its returning 0

explenation of how games set up: Menu -> levelselector -> Game. So I need to get result from levelselector into game, so it knows what level to start.

  • 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-11T03:56:44+00:00Added an answer on June 11, 2026 at 3:56 am

    (updated corrected response)
    Don’t use startActivityForResult().

    Try this for Activity A:


    Intent start = new Intent("nielsen.happy.activities.HAPPYACTIVITY");
    start.putExtra("level", getLevel());
    startActivity(start);
    finish();

    Then in Activity B, do this:


    Extras mBundle = getIntent().getExtras();
    int level = mBundle.getInt("level");

    (original, incorrect response)
    Lets call activity A the one that houses your sample code above.
    Lets call activity B the one that you refer to as HAPPACTIVITY.

    Activity A calls startActivityForResult() with a request code.
    Activity B starts up and before exiting, you call setResult(int code).

    When activity B finishes, A returns to the top via the method onActivityResult().

    Implement an onActivityResult() and see what attributes you get.

    FYI there is a condition where setResult(RESULT_OK) or setResult(RESULT_CANCELED) will not trigger onActivityResult() in A (I can’t recall what the case is).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now a project I'm working on has reached a level of complexity that
I am working with Michael Hartl's tutorial. When I run test I get this
I am working on Android project (API level 8) displaying WebView from another website
I'm working with a low-level API that accepts a char* and numeric value to
I'm working on a program that will tell what level a programmer is at
I'm working on a project in C that involves creating a user-level thread library
I am working on a magento website that has a 2-level (category and subcategory)
I'm working with kernel-level async I/O (i.e. libaio.h ). Prior to submitting a struct
Firstly my experience with c++ is limited! I am working on a level editor
I'm working at the audio buffer level, mixing audio signals created by a colleciton

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.