[android-developers] Re: How to inflate an xml file with ids from other apk?

2009-03-15 Thread David Yue

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/hellonote
 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
-~--~~~~--~~--~--~---



[android-developers] Re: How to inflate an xml file with ids from other apk?

2009-03-15 Thread Mercury

Hi quill

There are some questions for you maybe can help you solve this problem

first, from your question, Did you setup the akp into android
emulator? if yes, please reboot it, and try it again.
last time, we also had those problem when we setup new akp. at the
beginning, we also could get some sources
such as some wave files at raw, we reboot the emulator the program can
get them..

so my suggest is you can try it first...and check it...if u debug or
run under the emulator

I hope that can give you some helps...good luck and best regards!

Mercury

On 3月16日, 上午9时25分, 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/hellonote
 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
-~--~~~~--~~--~--~---



[android-developers] Re: How to inflate an xml file with ids from other apk?

2009-03-15 Thread quill

Hi, David,
yes, I have defined the string id hello in the strings.xml(in other
apk),
its id is 0x7f04 in R.java. And in my application, there is also a
string's id defined as
0x7f04, when the my application runs, it shows the string define
in my strings.xml, not in
the other apk.

On Mar 16, 9:36 am, David Yue a52...@motorola.com wrote:
 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/hellonote
  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?- 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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: How to inflate an xml file with ids from other apk?

2009-03-15 Thread quill

Hi Mercury,
yes, I setup the apk in the emulator. And I try to reboot the emulator
the problem
still exist. It seems the 'resourcemanager' treats the string ids as
locals


On Mar 16, 9:42 am, Mercury xumerc...@gmail.com wrote:
 Hi quill

 There are some questions for you maybe can help you solve this problem

 first, from your question, Did you setup the akp into android
 emulator? if yes, please reboot it, and try it again.
 last time, we also had those problem when we setup new akp. at the
 beginning, we also could get some sources
 such as some wave files at raw, we reboot the emulator the program can
 get them..

 so my suggest is you can try it first...and check it...if u debug or
 run under the emulator

 I hope that can give you some helps...good luck and best regards!

 Mercury

 On 3月16日, 上午9时25分, 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/hellonote
  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?- 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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---