I've create an menu (my toolbar) and an item inside of it (Settings)
menu.xml code:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.sergio.testecalc.MainActivity">
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:onClick="sendMessage"
android:title="@string/config"
app:showAsAction="never" />
I want to link the onClick with Settings_Activity.java, then I put this on Main_Activity.java:
public void sendMessage(View view)
{
Intent intent = new Intent(MainActivity.this, SettingsActivity.class);
startActivity(intent);
}
But Android Studio shows me that:
Method sendMessage in MainActivity has incorrect signature
Why? Whats wrong with my code? Sorry for my bad english :(