android - groovy error - cannot find matching method - how to solve -
i have simple activity in android class. anyway looks this:
package com.example.groovy import android.os.bundle import android.support.v7.app.actionbaractivity import com.example.r import groovy.transform.compilestatic @compilestatic public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); mymethod(); } public void mymethod(){ data data1=new data(); data1.setaddress("37 ibm blvd."); data1.setpostalcode("mc42l8") data1.setdate("feb 19"); data data2=new data(); data2.setaddress("38 oriole"); data2.setpostalcode("mc72l9") data2.setdate("feb 12"); data data3=new data(); data3.setaddress("37 skyway"); data3.setpostalcode("mt82l9"); data3.setdate("feb 13"); }
the data class looks this:
package com.example.groovy public class data{ def string address def string postalcode def string date }
if need know directory structure looks this:
here error when try run program:
/users/frost/documents/myandroidstudio/myrxjavaandroidproject2/app/src/main/groovy/com/example/groovy/mainactivity.groovy: 32: [static type checking] - cannot find matching method com.example.groovy.data#setdate(java.lang.string). please check if declared type right , if method exists.
this error repeats synthesized methods im trying access data pojo.
have tried sensible capitalisation, , without unnecessary def
s?
public class data{ string address string postalcode string date }
Comments
Post a Comment