java - start cannot be resolved or is not a field -


i have looked everywhere , have not found answer works. issue having making music player , media player.start won't work. here menu.java:

package com.hunter.pixalia; import android.app.activity; import android.content.intent; import android.media.mediaplayer; import android.os.bundle; import android.view.view; import android.widget.button; public class menu extends activity { @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_menu);              //buttons     button start = (button) findviewbyid(r.id.button1);     start.setonclicklistener(new view.onclicklistener() {          @override         public void onclick(view v) {             // todo auto-generated method stub             intent start = new intent(getapplicationcontext(), worldselect.class);             startactivity(start);         }     });       final mediaplayer mp = mediaplayer.create(this, r.raw.summertime_sadness);                 button b = (button)this.findviewbyid(r.id.button2);               b.setonclicklistener(new view.onclicklistener() {                  @override                 public void onclick(view v) {                     // todo auto-generated method stub                     mp.start; //<-- issue                 }             });  }  public boolean oncreateoptionsmenu(menu menu) {     // inflate menu; adds items action bar if present.     getmenuinflater().inflate(r.menu.menu, (android.view.menu) menu);     return true; } 

}

the xml:

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".menu" >  <button     android:id="@+id/button1"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_centerhorizontal="true"     android:layout_centervertical="true"     android:text="start" />  <imageview     android:id="@+id/imageview1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_above="@+id/button1"     android:layout_alignleft="@+id/button1"     android:src="@drawable/pixalia" />  <button     android:id="@+id/button2"     style="?android:attr/buttonstylesmall"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:layout_alignparentbottom="true"     android:layout_centerhorizontal="true"     android:text="music" /> 

i have tried cleaning, there no android.r; import , have done control+shift+o. nothing works , don't know problem. tried use

import com.pixalia.menu.r; 

nothing work

i think seems typo. if see documentation of start, seems function. think functions should defined mp.start(); not mp.start;.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -