android - Can not setContentView with layout resource file -
a package named "ui" created in package layout, , layout resource file "my_listview.xml" put in package "ui". setcontentview
"my_listview.xml" in mainactiviy.java
, failed. what's problem here? appreciated.
protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.my_listview); ... }
edit
if put "my_listview.xml" put in package "layout", setcontentview(r.layout.my_listview);
works.
you should place xml files in directories belong, not in custom directories. names of directories in res directory has meaning. example, resources layout-mdpi used if user has phone medium dpi screen. same thing other dirs. should read this,it helpfull: http://developer.android.com/guide/topics/resources/providing-resources.html
Comments
Post a Comment