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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:17:57+00:00 2026-05-30T09:17:57+00:00

package nidhin.survey; import android.app.Activity; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.*;

  • 0
package nidhin.survey;

import android.app.Activity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.*;
import android.os.Bundle;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.RadioGroup;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;

public class SurveyActivity extends Activity implements OnCheckedChangeListener

{
CheckBox cb;
String myChoice;

RadioButton radio1;
RadioButton radio2;
RadioButton radio3;
RadioButton radio4;
RadioGroup rg;
EditText text1;
Button button1;
Button button2;

public void onCreate(Bundle savedInstanceState) 

{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    cb=(CheckBox)findViewById(R.id.check);
    cb.setOnCheckedChangeListener(this);
    RadioGroup rg=(RadioGroup)findViewById(R.id.rg);
    radio1=(RadioButton)findViewById(R.id.radio1);
    radio2=(RadioButton)findViewById(R.id.radio2);
    radio3=(RadioButton)findViewById(R.id.radio3);
    radio4=(RadioButton)findViewById(R.id.radio4);
   // rg.setOnCheckedChangeListener(this);
    rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

        public void onCheckedChanged(RadioGroup group, int checkedId) {

            switch(checkedId)
            {
            case R.id.radio1:
                myChoice = "one";
                text1.setText(myChoice);
                break;
            case R.id.radio2:
                myChoice = "two";
                text1.setText(myChoice);
                break;
            case R.id.radio3:
                myChoice = "three";
                text1.setText(myChoice);
                break;
            case R.id.radio4:
                myChoice = "four";
                text1.setText(myChoice);
                break;
            }

        }
    }); 
    text1=(EditText)findViewById(R.id.etext1);
    text1.setText(myChoice);
    button1 = (Button) findViewById(R.id.button01);
    button1.setOnClickListener(new clicker());
    button2 = (Button) findViewById(R.id.button02);
    button2.setOnClickListener(new clicker());
}

    public void onCheckedChanged(CompoundButton buttonView,
    boolean isChecked) 
    {
        if (isChecked) 
            {
            cb.setText("Yes , I have a car!");
            }
        else 
            {
            cb.setText("  ");
            }

                    if (isChecked) {
                    TextView tv= new TextView (this);
                    tv.setText("You have a car , nice!");
                      }
    }


        class clicker implements Button.OnClickListener
        {
                public void onClick(View v)
                {                        
                    if(v==button1)
                    {
                        text1.setText(myChoice);
                        Toast.makeText(getBaseContext(), 

                            "~~~~Successfully submitted~~~", 
                            Toast.LENGTH_LONG).show();
                    }

                       if(v==button2)
                    {
                        Intent viewDataIntent = new Intent(this, Survey2.class);
                        String myData = "You should see this";
                        viewDataIntent.putExtra("valueOne", myData);
                        startActivity(viewDataIntent);
                    }
                }
        }



}

Hello , this seems to be a simple problem , but I cannot find a solution somehow. I am trying to pass from one activity to the other in my android application . So when the second button is clicked , the program must load the new activity.The error i get is with the line – Intent viewDataIntent = new Intent(this, Survey2.class); it says that the constructor Intent(SurveyActivity.clicker, Class) is undefined. Any ideas?

  • 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-30T09:17:59+00:00Added an answer on May 30, 2026 at 9:17 am

    Note you are creating new Intent object into View.OnClickListener class, so this is reference of OnClickListener, whereas

    public Intent (Context packageContext, Class cls) need a context object as first parameter, so do instead:

    Intent viewDataIntent = new Intent(v.getContext(), Survey2.class);
                            String myData = "You should see this";
                            viewDataIntent.putExtra("valueOne", myData);
                            startActivity(viewDataIntent);
    

    or

    Intent viewDataIntent = new Intent(SurveyActivity.this, Survey2.class);
                            String myData = "You should see this";
                            viewDataIntent.putExtra("valueOne", myData);
                            startActivity(viewDataIntent);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

package com.ebonybutler.cexample3; import android.app.Activity; import android.content.Intent; import android.content.pm.ActivityInfo; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener;
package com.example.Calc; import android.R.string; import android.app.ListActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.ArrayAdapter;
package com.example.android.home; import android.app.Activity; import android.os.Bundle; import android.widget.*; import android.view.*; public class HomeActivity extends
package com.example.helloandroid; import android.app.Activity; import android.os.Bundle; import android.widget.Button; import android.view.View; import android.view.View.OnClickListener; //Create an
package com.aviyehuda.test.multithreading; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.widget.Button; import android.widget.TextView;
package com.ave; import com.ave.R; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.ImageButton;
package com.parseador.prueba; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; public class main extends
package com.commonsware.android.layouts; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.Button; import java.util.Date; public class
package com.rest; import java.io.IOException; import android.app.Activity; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button;
package com.RaffDev.RaffApp; import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.view.View; import android.widget.Toast; import android.widget.AdapterView;

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.