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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:31:09+00:00 2026-06-11T11:31:09+00:00

I want to get a string and send it via the onClickListener method to

  • 0

I want to get a string and send it via the onClickListener method to other activity, I already have the code in another activity where it will be catched, I get it to work by doing this:
Example: String Culo = lblMensaje.getText().toString;

This way I could get the text and send it to another activity, but its not as efficent as sending the original string.. Would it be posible to send it?

final String sexos[] =
                new String[] {"00311712 Biología I","Mar-Jue 7:00am Prof.Briceño","Elem3","Elem4","Elem5"};

      final String[] datos =
                 new String[]{"0031711 Lab Biologia","Lun-Mar 9:30am prof. Marcarian","Elem3","Elem4","Elem5"};



        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.pipe);

            final TextView lblMensaje = (TextView)findViewById(R.id.LblMensaje);
            final Spinner cmbOpciones = (Spinner)findViewById(R.id.CmbOpciones);

            final String[] datos =
                    new String[]{"0031711 Lab Biologia","Lun-Mar 9:30am prof. Marcarian","Elem3","Elem4","Elem5"};


            ArrayAdapter<String> pipe =
                new ArrayAdapter<String>(this,
                    android.R.layout.simple_spinner_item, datos);


            pipe.setDropDownViewResource(
              R.layout.multiline_spinner_dropdown_item);



            cmbOpciones.setAdapter(pipe);

            cmbOpciones.setOnItemSelectedListener(
             new AdapterView.OnItemSelectedListener() {
                    public void onItemSelected(AdapterView<?> parent,
                        android.view.View v, int position, long id) {
                            lblMensaje.setText("Seleccionado: " + datos[position]);



                    }

                    public void onNothingSelected(AdapterView<?> parent) {
                        lblMensaje.setText("");
                    }

            });


            final TextView lblMensaje1 = (TextView)findViewById(R.id.LblMensaje1);
            final Spinner cmbOpciones1 = (Spinner)findViewById(R.id.CmbOpciones1);

            final String sexos[] =
               new String[] {"00311712 Biología I","Mar-Jue 7:00am Prof.Briceño","Elem3","Elem4","Elem5"};

         ArrayAdapter<String> adaptador1 =
            new ArrayAdapter<String>(this,
                android.R.layout.simple_spinner_item, sexos);



        adaptador1.setDropDownViewResource(
                android.R.layout.simple_spinner_dropdown_item);



        cmbOpciones1.setAdapter(adaptador1);

        cmbOpciones1.setOnItemSelectedListener(
         new AdapterView.OnItemSelectedListener() {
                public void onItemSelected(AdapterView<?> parent,
                    android.view.View v, final int position, long id) {          
                        lblMensaje1.setText(sexos[position]);




                }

                public void onNothingSelected(AdapterView<?> parent) {
                    lblMensaje1.setText("");
                }


        });
        Button BotonPasar1;
        BotonPasar1 = (Button)findViewById(R.id.VB1);
         BotonPasar1.setOnClickListener(new View.OnClickListener(){

         public void onClick(View v) {
            // TODO Auto-generated method stub


            String Culo;

       Culo = datos[position];
            String Culoq;
            Culoq = sexos[position];



            SharedPreferences mypreferences = getSharedPreferences("myPrefs", Context.MODE_PRIVATE);
            SharedPreferences.Editor editor = mypreferences.edit();
            editor.putString("Culo",Culo);
            editor.commit();



               SharedPreferences mypreferences1 = getSharedPreferences("myPrefs", Context.MODE_PRIVATE);
              SharedPreferences.Editor editor1 = mypreferences1.edit();
            editor1.putString("Culoq", Culoq);
            editor1.commit();

                  String Culo1 = String.valueOf(Culoq + 1);

            SharedPreferences mypreferences2 = getSharedPreferences("myPrefs", Context.MODE_PRIVATE);
            SharedPreferences.Editor editor2 = mypreferences2.edit();
            editor2.putString("Culo1",Culo1);
            editor2.commit();

         }

        });
         Button BotonPasar2;
         BotonPasar2 = (Button)findViewById(R.id.VB2);
          BotonPasar2.setOnClickListener(new View.OnClickListener(){

          public void onClick(View v) {
             // TODO Auto-generated method stub
           Intent pasarahorario = new Intent("com.reversiblelabs.unisvenecas.udobeta.HORARIO");                          
          startActivity(pasarahorario);

          }

         });


        }

    }
  • 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-11T11:31:10+00:00Added an answer on June 11, 2026 at 11:31 am

    this may helps you

    like SharedPreferences
    in your First ActivityA

               Intent myintent= new Intent(FirstActivity.this,SecondActivity.class);
                SharedPreferences spref = this.getSharedPreferences("mynotifyid", MODE_WORLD_WRITEABLE);
                SharedPreferences.Editor spreedit = spref.edit();
                spreedit.putString("Name1", str1.toString());              
                spreedit.commit();
                startActivity(myintent);
    

    in your Second ActivityB

            SharedPreferences spref = context.getSharedPreferences("mynotifyid", Context.MODE_WORLD_WRITEABLE);
            String str1 = spref.getString("Name1","");
    

    for your object saving purpose use SharedPreferences

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

Sidebar

Related Questions

Hello everybody i have C++ tStringGrid I want to get string from specific cell
I want to get a url from a string. Heres my code to extract
I have a string pc1|pc2|pc3| I want to get each word on different line
I have this code where I send data in an XML file via cURL
I want to get the string length when a key is pressed like StackOverflow
dim dataType as String toolTip=Marks And Number[String] I want to get the [String] alone.
I'm writing an Apache module and want to get a string with the Apache
I want to get the quoted string in the line below into a string
I've WCF Service that response with JSON. I want to get the JSON String
I want to get 100 and example from this string ?connect:100/username:example/ I searched in

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.