Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Development: "Cannot be resolved"
    primarykey
    data
    text
    <p>Hoping to get into android app development so I'm doing some basic tutorials just now.</p> <p>Just trying to get comfortable with the basics at the moment, one of which is using the Typeface class.</p> <pre><code>package org.me.myandroidstuff; import android.os.Bundle; import android.app.Activity; import android.graphics.Typeface; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.widget.Toast; public class HelloWorldActivity extends Activity implements OnClickListener { private View mainView; private TextView tbox1; private Button exitButton; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); mainView=(View)findViewById(R.id.mainView); mainView.setBackgroundColor(getResources().getColor(R.color.silver)); tbox1 = (TextView)findViewById(R.id.textBox1); tbox1.setTypeface(Typeface.MONOSPACE); } } </code></pre> <p>The line</p> <pre><code>tbox1 = (TextView)findViewById(R.id.textBox1); </code></pre> <p>Has a red cross beside it (I'm using eclipse) with the error</p> <pre><code>tbox1 cannot be resolved </code></pre> <p>Its been a while since i have used java, but as i aware the following code</p> <ol> <li>create a new TextView object called tbox1</li> <li>Assigns the tbox1 object the id specified in the xml for the TextView tag in an external main.xml</li> <li>Then tbox1 executes the setTypeFace() method on itself?</li> </ol> <p>Obviously I'm going wrong somewhere, any ideas? Something really simple no doubt...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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