DSpotDevelopers / declex

DecleX - Declarative Framework for Android, easier and faster coding.
Other
168 stars 25 forks source link

In API < 21, $AlertDialog().view() method returns an error #122

Open yasmanmesa opened 7 years ago

yasmanmesa commented 7 years ago

In previous versions of DecleX the view of the $AlertDialog() was established using the builder(), so it looked more like this:

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    @Click
    void btnConfigServer(){
        $AlertDialog().title(getString(R.string.app_name)).positiveButton("Aceptar").negativeButton("Cancelar").builder().setView(R.layout.dialog_server);
        if ($AlertDialog.Dismissed){
            $PutModel(config);
        }
    }

In this example you should put @TargetApi (Build.VERSION_CODES.LOLLIPOP) 'cause this call requires API 21.

Currently you can set the view of $AlertDialog using the view method but it returns this error:

java.lang.NoSuchMethodError: android.app.AlertDialog$Builder.setView
smaugho commented 7 years ago

Thanks for reporting