Note that there are some explanatory texts on larger screens.

plurals
  1. POthe value of the field Main.Activity.b1 is not used
    text
    copied!<p>can some one help me out im trying the onclick android tutorial how how to change pages with a button but im stuck im getting an error that says the value of the field Main.Activity.b1 is not used i cant figure it out</p> <pre><code> package com.example.lasttry; package com.example.lasttry; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.content.Intent; public class MainActivity extends Activity implements OnClickListener { private Button b1; public final static String EXTRA_MESSAGE = "com.example.lasttry"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); this.setContentView(R.layout.activity_main); this.b1 = (Button)this.findViewById(R.id.b1); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.activity_main, menu); return true; } @Override public void onClick(View v) { finish(); // TODO Auto-generated method stub } public void sendMessage(View v){ Intent intent = new Intent(this, DisplayMessageActivity.class); EditText editText= (EditText) findViewById(R.id.b1); String message = editText.getText().toString(); intent.putExtra(EXTRA_MESSAGE, message); startActivity(intent); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload