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

The Archive Base Latest Questions

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

Hi I have an array that stores when radio buttons are checked so that

  • 0

Hi I have an array that stores when radio buttons are checked so that when I load the radio settings again I can set the apporpriate one as checked.

My array is like this :

   |0          |1         |2
----------------------------------
0  |Option1    |data      |false
----------------------------------
1  |Option2    |data      |true
----------------------------------
2  |Option3    |data      |false
----------------------------------
3  |Option4    |data      |false

etc….

Now the index I am interested in is the true/false one as that tells me if that radio button should be checked.

I read these values from a database into the array. That’s all working fine and the data is in the array correctly.

For some reason when I do a comparison it does not match it up with what I can see is correct.

This is what I am doing in a loop…

String checked = myarray[i][2];

// This correctly outputs 'false', 'true', 'false' and 'false' as per the array above.            
Toast.makeText(DatabaseTestActivity.this, checked, Toast.LENGTH_LONG).show();

// Now when it gets here it fails to trigger the match for 'true'.
if (checked == "true") {
     active = i;
     Toast.makeText(DatabaseTestActivity.this, "Found Check", Toast.LENGTH_LONG).show();
}

Any idea on what I am doing wrong ? It’s just a simple string compare, or so I thought ??

  • 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:44:36+00:00Added an answer on May 26, 2026 at 12:44 pm

    Use String.equals() to compare strings.

    if (checked.equals("true")) {
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP class that stores a complex multidimensional array, and rather than
I have an array that looks like: $fields = array( f1 => array(test), f2
I have an array that looks like $numbers = array('first', 'second', 'third'); I want
I have a array that looks like this Array ( [provider] => Array (
I have an array that stores a few urls of XML files that need
Using java for Android development. I have an array that stores image resources. The
I have an array of java objects. Each object stores two longs that define
I have an array that stores names of countries (keys) and age expectancy (values).
Hi If you have an array that stores images and text then displays the
I have a multidimensional array that stores people. Array ( id93294 => array (

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.