0

I am new in android programming, having error in the given code which are: Multiple markers at this line

-Button1 cannot be resolved to a variable

-Syntax error on token "@", class expected

-id cannot be resolved to a variable

-Line breakpoint:MainActivity [line: 22] - onCreate(Bundle)

public class MainActivity extends Activity {

    Button aButton;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        aButton = (Button) this.findViewById(R.id.Button_1);
        aButton.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                aButton.setText("Submitted");
    }});

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
 }
Rustam
  • 6,485
  • 1
  • 25
  • 25

1 Answers1

0

1.u must have activity_main and it should include Button with Button_1 2.check .JavaClassName added in Manifest file

khushal rasali
  • 221
  • 2
  • 4