Método de botão onClick do fragmento do Android
Estou tentando invocar o método no meu onClick (View v) XML, mas não funciona com o Fragment. Esse é o erro.
01-17 12:38:36.840: E/AndroidRuntime(4171): java.lang.IllegalStateException:
Could not find a method insertIntoDb(View) in the activity class main.MainActivity
for onClick handler on view class android.widget.Button with id 'btn_conferma'
MainActivity.java
public void insertIntoDb(View v) {
...
}
código xml
<Button
android:id="@id/btn_conferma"
style="?android:attr/borderlessButtonStyle"
android:layout_width="0.0dip"
android:layout_height="45dp"
android:layout_marginLeft="2dp"
android:layout_weight="1.0"
android:background="@drawable/bottoni"
android:gravity="center_horizontal|center_vertical"
android:onClick="insertIntoDb"
android:text="SALVA"
android:textColor="#ffffff"
android:textSize="16sp" />