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

  • Home
  • SEARCH
  • 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 3359552
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:53:10+00:00 2026-05-18T02:53:10+00:00

I have searched and searched and I just can’t get this code to work.I

  • 0

I have searched and searched and I just can’t get this code to work.I have a main.xml layout and a setting.xml.I have some values I would like the Settings.class to change in my main apps class.Three string to be exact.

I have tried this simple test code in my main app class

settings.setOnClickListener(new OnClickListener(){

   @Override
   public void onClick(View v) {
    Intent intent = new Intent(v.getContext(), Settings.class);
     startActivityForResult(intent, 0);


   }
   });

//Then a function
 @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent intent){
      super.onActivityResult(requestCode, resultCode, intent);
      Bundle extras = intent.getExtras();
      String value = extras.getString("myKey");
      if(value!=null){
      Log.d("hmmm",value);
      }
  }
}

In my settings.class I have the following

 returnHome.setOnClickListener(new OnClickListener(){

    @Override
    public void onClick(View v) {
     Intent intent = new Intent();
     intent.putExtra("myKey", "YEAH"); 
                 setResult(RESULT_OK, intent);
                 finish();


    }

         });

Back in main app class it is not getting logged.

Like I said I have three string in the main class that I want settings class to change and send back.
Any help is greatly appreciated

  • 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-18T02:53:11+00:00Added an answer on May 18, 2026 at 2:53 am

    I have had success with the technique used in the Notepad tutorial where the information is placed in a Bundle and then added to the intent. See Step 10:

    Bundle bundle = new Bundle();
    
    bundle.putString(NotesDbAdapter.KEY_TITLE, mTitleText.getText().toString());
    bundle.putString(NotesDbAdapter.KEY_BODY, mBodyText.getText().toString());
    if (mRowId != null) {
        bundle.putLong(NotesDbAdapter.KEY_ROWID, mRowId);
    }
    
    Intent mIntent = new Intent();
    mIntent.putExtras(bundle);
    setResult(RESULT_OK, mIntent);
    finish();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have searched around, and it seems that this is a limitation in MS
I've have searched on this and it seems to be a catch all, unfortunately
How can I find the parameters of an undocumented Dll function? I have searched
I've searched for this a little but I have not gotten a particularly straight
I have tried many queries, but this gets me my OU: (&(objectCategory=organizationalUnit)(Name=MyOU)) (I just
I have searched, but nothing happens, I just starting using C#.NET and I a
I have searched the web for resolution of this error, but everything I have
First of all this is all just concept, I have no actual programming done
I have this code: def random_answerlist(self): self.li = [] self.winning_button = random.randint(0, 3) i
I have searched but apparently my google foo is weak. What I need is

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.