android - Expected resource of type ID -


i using anko build simple project. when try set id edittext getting following error.

ensures resource id's passed apis of right type; example, calling resources.getcolor(r.string.name) wrong.

import android.support.v7.app.appcompatactivity import android.os.bundle import org.jetbrains.anko.*  class mainactivity : appcompatactivity() {  override fun oncreate(savedinstancestate: bundle?) {     super.oncreate(savedinstancestate)     relativelayout {         edittext{             id = 1         }     } } } 

click here view error image format

you can either use id references (r.id.something) or negative integers -16777215 -1 (and ignore warning).

suitable negative integers can generated using view.generateviewid() method available since api 17. source code available here. you'll have remember generated values yourself.

generating r.id covered in other answers.

i trying same getting error

the video published on year ago , lint didn't warn kotlin code then.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -