The message is a bit vague I guess. The way I read it was that it couldn't find an xml file with that id. That would likely be in reference to an xml in res/layout. I don't know where you see anything mentioned in the API. The docs are empty for createFromResource in my local m5-rc14 copy. The only information I had to go off of in the docs is they named the variable "textViewResId" which suggests they are looking for the id of a TextView. And with my experience working with ListView, I don't think it's really the id of the TextView itself, but of the layout that contains it.
On Apr 11, 11:56 pm, pyf <[EMAIL PROTECTED]> wrote: > Yes, it's working. > You mean the way I used is not correct? > but that's what mentioned in API. > From exception, it seems it could not find android.R.id.list. > > On Apr 12, 1:17 pm, "Dan U." <[EMAIL PROTECTED]> wrote: > > > You are extending ListActivity right? Maybe you could try using > > android.R.layout.simple_list_item_1 in your createFromResource call > > instead of android.R.id.list. > > > On Apr 11, 8:37 pm, pyf <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > I'm trying to customize layout by having ListView in it. > > > This is my code: > > > ========================================================= > > > public void onCreate(Bundle icicle) { > > > super.onCreate(icicle); > > > requestWindowFeature(Window.FEATURE_NO_TITLE); > > > setContentView(R.layout.wardrobe_layout); > > > setListAdapter(ArrayAdapter.createFromResource(Project.this, > > > R.array.collections, android.R.id.list)); > > > } > > > ========================================================= > > > and my layout XML: > > > ========================================================= > > > <?xml version="1.0" encoding="utf-8"?> > > > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ > > > android" > > > android:layout_width="fill_parent" > > > android:layout_height="fill_parent" > > > android:orientation="vertical" > > > > <ListView id="@android:id/list" > > > android:layout_width="fill_parent" > > > android:layout_height="wrap_content" > > > android:layout_weight="1" > > > android:drawSelectorOnTop="false" > > > /> > > > </LinearLayout> > > > ========================================================= > > > but I've got "File from xml type layout resource ID #0x1050005" in > > > screen, and exception in debug monitor: > > > > ========================================================= > > > E/AndroidRuntime(815): android.content.Resources$NotFoundException: > > > File from xml type layout resource ID #0x1050005 > > > E/AndroidRuntime(815): at > > > android.content.Resources.loadXmlPullParser(Resources.java:1783) > > > E/AndroidRuntime(815): at > > > android.content.Resources.loadXmlPullParser(Resources.java:1726) > > > E/AndroidRuntime(815): at > > > android.content.Resources.getLayout(Resources.java:446) > > > E/AndroidRuntime(815): at > > > android.view.ViewInflate.inflate(ViewInflate.java:211) > > > E/AndroidRuntime(815): at > > > android.view.ViewInflate.inflate(ViewInflate.java:161) > > > E/AndroidRuntime(815): at > > > android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java: > > > 179) > > > E/AndroidRuntime(815): at > > > android.widget.ArrayAdapter.getView(ArrayAdapter.java:171) > > > E/AndroidRuntime(815): at > > > android.widget.ListView.onMeasure(ListView.java:697) > > > E/AndroidRuntime(815): at android.view.View.measure(View.java: > > > 4857) > > > E/AndroidRuntime(815): at > > > android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:1234) > > > E/AndroidRuntime(815): at > > > android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java: > > > 732) > > > E/AndroidRuntime(815): at > > > android.widget.LinearLayout.measureVertical(LinearLayout.java:289) > > > E/AndroidRuntime(815): at > > > android.widget.LinearLayout.onMeasure(LinearLayout.java:231) > > > E/AndroidRuntime(815): at android.view.View.measure(View.java: > > > 4857) > > > E/AndroidRuntime(815): at > > > android.view.ViewGroup.measureChild(ViewGroup.java:1202) > > > E/AndroidRuntime(815): at > > > android.widget.FrameLayout.onMeasure(FrameLayout.java:148) > > > E/AndroidRuntime(815): at android.view.View.measure(View.java: > > > 4857) > > > E/AndroidRuntime(815): at > > > android.view.ViewGroup.measureChild(ViewGroup.java:1202) > > > E/AndroidRuntime(815): at > > > android.widget.FrameLayout.onMeasure(FrameLayout.java:148) > > > E/AndroidRuntime(815): at android.policy.PhoneWindow > > > $DecorView.onMeasure(PhoneWindow.java:1076) > > > E/AndroidRuntime(815): at android.view.View.measure(View.java: > > > 4857) > > > E/AndroidRuntime(815): at > > > android.view.ViewRoot.performTraversals(ViewRoot.java:290) > > > E/AndroidRuntime(815): at > > > android.view.ViewRoot.handleMessage(ViewRoot.java:547) > > > E/AndroidRuntime(815): at > > > android.os.Handler.dispatchMessage(Handler.java:80) > > > E/AndroidRuntime(815): at android.os.Looper.loop(Looper.java:71) > > > E/AndroidRuntime(815): at > > > android.app.ActivityThread.main(ActivityThread.java:2506) > > > E/AndroidRuntime(815): at > > > java.lang.reflect.Method.invokeNative(Native Method) > > > E/AndroidRuntime(815): at > > > java.lang.reflect.Method.invoke(Method.java:380) > > > E/AndroidRuntime(815): at android.os.ZygoteInit > > > $MethodAndArgsCaller.run(ZygoteInit.java:1170) > > > E/AndroidRuntime(815): at > > > android.os.ZygoteInit.main(ZygoteInit.java:1121) > > > E/AndroidRuntime(815): at android.dalvik.NativeStart.main(Native > > > Method) > > > E/AndroidRuntime(815): Caused by: java.io.FileNotFoundException: > > > E/AndroidRuntime(815): at > > > android.content.AssetManager.openNonAssetNative(Native Method) > > > E/AndroidRuntime(815): at > > > android.content.AssetManager.openNonAsset(AssetManager.java:372) > > > E/AndroidRuntime(815): at > > > android.content.Resources.loadXmlPullParser(Resources.java:1774) > > > E/AndroidRuntime(815): ... 30 more > > > ========================================================= > > > > May I know what's the problem? it does not seem to be the identifier > > > problem, I tried with @android:id/list, @id/android:list and > > > @android:id/android:list ...but still having the same result. > > > > Something missing? > > > > Appreciate your help!- Hide quoted text - > > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---