Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help to be able to click on the exclamation in image Am trying to run this prgram on Android studio here are the error

Need help to be able to click on the exclamation in image image text in transcribed Am trying to run this prgram on Android studio here are the error am getting : Error:(39, 19) error: cannot find symbol class OnclickListener Error:(29, 38) error: cannot find symbol method findViewByid(int) Error:(35, 16) error: variable exclaimBtn is already defined in method onCreate(Bundle) Error:(35, 38) error: cannot find symbol method findViewByid(int) Error:(39, 60) error: cannot find symbol class OnClickListner Error:Execution failed for task ':app:compileDebugJavaWithJavac'. > Compilation failed; see the compiler error output for details. package com.ademola.hellogoodbye; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.view.Menu; import android.view.MenuItem; import android.widget.Button; import android.widget.TextView; import static android.view.View.*; public class MainActivity extends AppCompatActivity { //DECLARE TEXT REFERENCE TO THE INTERFACE LAYOUT COMPONENT  private TextView greetingTextview; //INDICATES HELLO IS CURRENTLY DISPLAYED  private boolean isHello; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); greetingTextview = (TextView) findViewById(R.id.textView); Button exclaimBtn = (Button) findViewByid(R.id.button); //TASK 3: INITIALIZE GREETINGS  initializeGreeting(); //TASK 4: REGISTER THE LISTENER EVENT FOR THE BOTTON  Button exclaimBtn = (Button) findViewByid(R.id.button); exclaimBtn.setOnclickListener(toggleGreeting); } private final OnclickListener toggleGreeting = new View.OnClickListner() { public void onClick(View btn) { //Task: CONSTRUCT THE TOGGLE GREETING  if (isHello) { isHello = false; grettingTextView.setText(R.string.goodbye); } else { isHello = true; greetingTextView.setText(R.string.hello); } } }; private void initializeGreeting() { isHello = true; } /*  Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);  setSupportActionBar(toolbar);   FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);  fab.setOnClickListener(new View.OnClickListener() {  @Override  public void onClick(View view) {  Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)  .setAction("Action", null).show();  }  });  */   @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu;  // this adds items to the action bar if it is present.  getMenuInflater().inflate(R.menu.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(); /oinspection SimplifiableIfStatement  if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } 
L a 2:55 LTE Hello EXCLAMATION L a 2:55 LTE Hello EXCLAMATION

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

Why is character so important to those who hope to lead others?

Answered: 1 week ago

Question

Factors affecting international financial management

Answered: 1 week ago