How to get a special layout xml file in another application

by quill » Fri, 13 Mar 2009 13:09:58 GMT


Sponsored Links
 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"--------------------------------------
    />
</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?
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Guna Nya SDCard di Partisi itu buat apa yah? (HTC MAGIC 32A)

Magic pake custom ROM yg uda support apps2sd aja bro jadi tinggal bikin partisi 
di sdcard
@jakontil
ris...@naekgenteng.com

-----Original Message-----
From: "Reza.Iransah" <logay.pek...@gmail.com>
Date: Sat, 27 Feb 2010 00:12:49 
To: Indonesian Android Community [id-android]<id-android@googlegroups.com>
Subject: [id-android] Re: Guna Nya SDCard di Partisi itu buat apa yah? (HTC 
        MAGIC 32A)

pengen coba juga nih....

ternyata internal memory saya udh tinggal 40mb lagi....

ga kerasa gini uy....

tapi bikin app2sd nya susah juga yah ternyata....

punya tutorial buat magic nya ga nih?

soalnya saya ga nemu....
hehehehhehe







> Join:

2. running android application

hi...

I have complete code of an android application running well .
But this application will run only on clicking its icon in the menu

I WANT THIS APPLICATION TO RUN WHEN " 5 " BUTTON ON THE ANDROID
KEYBOARD IS CONTINUOUSLY PRESSED  FOR MORE THAN 5sec

How do i do it..... Plz... help me its urgent


Thanking You in Advance
sid

-- 

3. YM gak bisa login ?

4. 18 android apps to get you started

5. Om kenapa saya udah upgrade radio, stuck di gambar HTC,terus restart-restart lagi....HTC MAGIC 32 A

6. Om kenapa saya udah upgrade radio, stuck di gambar HTC,terus restart-restart lagi....HTC MAGIC 32 A

7. Guna Nya SDCard di Partisi itu buat apa yah? (HTC MAGIC 32A)