Android:How to write to SQL database

前端 未结 2 1650
日久生厌
日久生厌 2021-01-26 17:25

I have been trying to follow the newBoston tutorial and find myself with a runtime error when I click a button to write data to a database. LogCat displays \"Could not find a me

2条回答
  •  隐瞒了意图╮
    2021-01-26 18:08

    LogCat displays "Could not find a method addModuleButton(View) in the activity."

    Your button seems to use the XML attribute android:onClick="addModuleButton", so simply change this:

    public void onClick (View addModuleButton) 
    

    into this:

    public void addModuleButton (View view)
    

    From the onClick documentation:

    This name must correspond to a public method that takes exactly one parameter of type View. For instance, if you specify android:onClick="sayHello", you must declare a public void sayHello(View v) method of your context (typically, your Activity).

提交回复
热议问题