I cant find whats wrong with my code I am getting cannot be resolved or is not a field on findViewById.
the problems lines are:
playSeekBar = (ProgressBar) findViewById(R.id.progressBar1);
buttonPlay = (Button) findViewById(R.id.buttonPlay);
buttonStopPlay = (Button) findViewById(R.id.buttonStopPlay);
my xml code is:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar android:id="@+id/progressBar1" android:layout_width="wrap_content" android:layout_height="wrap_content"></ProgressBar>
<Button android:text="Button" android:id="@+id/buttonPlay" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
<Button android:text="Button" android:id="@+id/buttonStopPlay" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
</LinearLayout>
my code is:
public class radioActivite extends Activity implements OnClickListener {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.radio_xml);
initializeUIElements();
initializeMediaPlayer();
}
private void initializeUIElements() {
playSeekBar = (ProgressBar) findViewById(R.id.progressBar1);
playSeekBar.setMax(100);
playSeekBar.setVisibility(View.INVISIBLE);
buttonPlay = (Button) findViewById(R.id.buttonPlay);
buttonPlay.setOnClickListener(this);
buttonStopPlay = (Button) findViewById(R.id.buttonStopPlay);
tried to clean the code but didn’t help me.
Thanks for the help!
Try removing your R.java so that it is regenerated. This is often Eclipse that does not see your changes in your res/ directory.
Another reason your R.java is not regenerated is you may have a problem in one of your resources (layout, styles, etc.)