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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:36:45+00:00 2026-05-30T15:36:45+00:00

i have 2 arrays first for Hours and second for minutes, this is my

  • 0

i have 2 arrays first for Hours and second for minutes, this is my arrays declare it in string.xml

   ` <string-array name="feedbacktypelist">
    <item>@string/hr0</item>  
    <item>@string/hr1</item>  
    <item>@string/hr2</item>  

</string-array>

<string-array name="array2">
    <item>@string/min5</item>  
    <item>@string/min10</item>  
    <item>@string/min15</item>  
    <item>@string/min20</item>  
    <item>@string/min25</item>  
    <item>@string/min30</item>
    <item>@string/min35</item>  
    <item>@string/min40</item>  
    <item>@string/min45</item>
    <item>@string/min50</item>  
    <item>@string/min55</item>  
    <item>@string/min59</item>


</string-array>`

and this is my code in java

  package lmp.app.pkg;

  import android.app.Activity;
  import android.app.ProgressDialog;
  import android.content.Intent;
  import android.database.Cursor;
  import android.graphics.Bitmap;
  import android.net.Uri;
  import android.os.Bundle;
  import android.provider.MediaStore;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemSelectedListener;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.EditText;
  import android.widget.ImageView;
  import android.widget.RadioGroup;
  import android.widget.RadioGroup.OnCheckedChangeListener;
  import android.widget.Spinner;
  import android.widget.TextView;
  import android.widget.Toast;

  public class CreateNewForm extends Activity implements OnItemSelectedListener  {


Button Browse;
ImageView  CasePic;
Spinner CaseDurationH, CaseDurationM;
TextView tesst;
RadioGroup GenderSelection;
EditText CaseName, CaseClothes, CaseMoreInfo, CaseAge;
Button Next;
//For Browsering Picture 
private static final int SELECT_PICTURE = 1;
private String selectedImagePath;

@Override
protected void onCreate(Bundle savedInstanceState) 
{

    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.create_new_form);

    //To Call initializer Function 
    initializer();

    //j list

    // 1-For Uploading Picture
    Browse.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) {
            // TODO Auto-generated method stub
             // in onCreate or any event where your want the user to
            // select a file
            Intent intent = new Intent();
            intent.setType("image/*");
            intent.setAction(Intent.ACTION_GET_CONTENT);
            startActivityForResult(Intent.createChooser(intent,
                    "Select Picture"), SELECT_PICTURE);
        }
    });

    // 1-Name
    final MyCase case1 = new MyCase();
    case1.setName(CaseName.getText().toString());

    // 2-Gender For Group Radio
    GenderSelection.clearCheck();
    GenderSelection.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        public void onCheckedChanged(RadioGroup group, int checkedId) {
             switch (checkedId) {
            case R.id.radio0:
                case1.setGender("Male");
                break;
            case R.id.radio1:
                case1.setGender("Female");
                break;
            default:
                break;
            }

        }
    });

    //3-Age

     String age = CaseAge.getText().toString();


    /*int tstnum =case1.getAge();
    tesst.setText(tstnum); */

     //4-Duration Time
    ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
            this, R.array.feedbacktypelist, android.R.layout.simple_spinner_item);
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    CaseDurationH.setAdapter(adapter);


    //5-Case Clothes
    case1.setClothes(CaseClothes.getText().toString());

    //6-Case More Information
    case1.setMoreInfo(CaseMoreInfo.getText().toString());

    //Move to 2nd form page
    Next= (Button)findViewById(R.id.Next2);
    Next.setOnClickListener(new View.OnClickListener() {

        public void onClick(View v) { 
            switch (v.getId()) { 
            case R.id.Next2:
                try
                {
                     Intent k = new Intent(CreateNewForm.this, CreateNewForm_2.class);

                     startActivity(k);

                }catch(Exception e){

                }

                break;

            }
        }
            });



  //Spinner
    CaseDurationH.setOnItemSelectedListener(new OnItemSelectedListener() {
        int i =CaseDurationH.getSelectedItemPosition();
        public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
            int i = CaseDurationH.getSelectedItemPosition();

            if(i==2){
                CaseDurationM.setEnabled(false);
            }
            String str = parent.getSelectedItem().toString();

            if(str.equals("hr0"))
                    {

                }

            if(str.equals("hr1"))
                    {

                }


            if(str.equals("hr2"))
                    {
                CaseDurationM.setEnabled(false);  
                }



            }
        public void onNothingSelected(AdapterView<?> arg0) {
            // TODO Auto-generated method stub

        } });

}


// To initialize the variables 
private void initializer() {
    // TODO Auto-generated method stub
    //This information will be filled by a user
            //CasePic = (ImageView) findViewById(R.id.imageView1);
            CaseName= (EditText) findViewById(R.id.caseNm);
            GenderSelection= (RadioGroup) findViewById(R.id.radioGroup1);
            CaseAge= (EditText) findViewById(R.id.caseaage);
            tesst= (TextView) findViewById(R.id.textView8);
            CaseDurationH= (Spinner) findViewById(R.id.Shr);
            CaseDurationM= (Spinner) findViewById(R.id.Smin);
            CaseClothes= (EditText) findViewById(R.id.caseClothes);
            CaseMoreInfo= (EditText) findViewById(R.id.caseMrInfo);
            CasePic = (ImageView) findViewById(R.id.casepic);
            Browse = (Button) findViewById(R.id.browseCasePic);
}


//For Uploading Picture
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
        if (requestCode == SELECT_PICTURE) {
            Uri selectedImageUri = data.getData();
            selectedImagePath = getPath(selectedImageUri);
        }
    }
}

//For Uploading Picture
public String getPath(Uri uri) {
    String[] projection = { MediaStore.Images.Media.DATA };
    Cursor cursor = managedQuery(uri, projection, null, null, null);
    int column_index = cursor
            .getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
    cursor.moveToFirst();
    return cursor.getString(column_index);
}


public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
        long arg3) {
    // TODO Auto-generated method stub

}


public void onNothingSelected(AdapterView<?> arg0) {
    // TODO Auto-generated method stub

}


}

i want:
1- retrieve the item in spinner that the user choose it, not the positon
2-if the user choose from spinner1 the item “hr02” then the spinner2 will disable

Thank you for help me, StackOverFlow members your my hero now! :”)

  • 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-30T15:36:47+00:00Added an answer on May 30, 2026 at 3:36 pm

    use this

    String str = parent.getSelectedItem().toString();
    
    if(str.equals("hr2")
    {
        spinner2.setEnabled(false);  
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two arrays the first one has this structure Parameter Keys array array
i have two arrays like this first array Array ( [0228] => Array (
Suppose I have two arrays like the following: $arr2 = array(array(first, second), array(third, fourth));
I have 2 arrays, so first is: { title_heading_1: Name, last_name: Trenkle, first_name: Jason,
I have two arrays, the first one contents numbers and the second one use
This is the first time I have manipulated hashes and arrays in this way
I have an array that looks like $numbers = array('first', 'second', 'third'); I want
After some recursive function I have an array: first iteration: Array ( [category_id] =>
I have image Array with two images out of that first image its showing
Based on this SO question asked a few hours ago, I have decided to

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.