Did you define the string id "hello" in the strings.xml file?
You may need define it in the 'other apk' 's strings.xml file, you can
try.

On Mar 16, 9:25 am, quill <quill...@163.com> wrote:
> Hi, guys,
> I want to inflate a layout xml file(in different apk), so I use
> res = getPackageManager().getResourcesForApplication(appname); to get
> the resource; and than use mInflater.inflate(res.getLayout(resId),
> null); to inflate the layout.
> The problem is, when the xml file is defined as follows:
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent"
>     >
> <TextView
>     android:layout_width="fill_parent"
>     android:layout_height="wrap_content"
>     android:text="hello"----------------------------------->note this
>     />
> </LinearLayout>
> It works correctly, the text "hello" will be show on the screen.
> But when I defined the xml file like this:
> <?xml version="1.0" encoding="utf-8"?>
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/
> android"
>     android:orientation="vertical"
>     android:layout_width="fill_parent"
>     android:layout_height="fill_parent"
>     >
> <TextView
>     android:layout_width="fill_parent"
>     android:layout_height="wrap_content"
>     android:text="@string/hello"-------------------------------->note
> this
>
>     />
> </LinearLayout>
> you know, the text was difined by string ids, so when my application
> load this, it can't find the string id. How can I do?
--~--~---------~--~----~------------~-------~--~----~
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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to