I want to change the current activity to another activity in android using a button. However whenever I click the button, eclipse debug perspective comes up with the error “source not found”. This is the function I’m using to change the activity
public void toManager(){
Intent i = new Intent(getApplicationContext(), DegreeActivity.class);
startActivity(i);
}
In my xml file, the button has an onClick listener. This is the xml
<Button
android:id="@+id/btn_toDegree"
android:text="@string/btn_toDegree"
android:textSize="13pt"
android:layout_centerVertical="true"
android:gravity="center"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_marginLeft="15dip"
android:layout_marginRight="15dip"
android:onClick="toManager" <!-- This line -->
/>
If I call the toManager() function in the onCreate() block of the first activity, It switches to the next activity with no error. However when I try to switch using the button it doesn’t work.
Click handler must look like:
From Button documentation: