Using onClick attribute in layout xml causes a NoSuchMethodException in Android dialogs

后端 未结 9 1561
说谎
说谎 2020-11-29 07:45

I have created a custom dialog and a layout xml:




        
相关标签:
9条回答
  • 2020-11-29 08:24

    Dialogs need the signature

    dialogClicked(DialogInterface dialog, int id) { ... }
    
    0 讨论(0)
  • 2020-11-29 08:27

    android:onClick="method" is pretty cool, but it doesn't work on Android 1.5 so I am avoiding for some time.

    An easy workaround:

    Make your Dialog an Activity and use android:theme="@android:style/Theme.Dialog" in you AndroidManifest.

    0 讨论(0)
  • system looks for the method in the where the layout has been inflated from, or in the activity class to which the xml was set as content.

    0 讨论(0)
提交回复
热议问题