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. Android JNI AttachCurrentThread throws an exception in java

Hi,

I have read about how to use AttachCurrentThread in JNI and it looks
exactly like the examples, but whenever i call this method in one of
the callbacks from other thread, i get following exception in logcat

W/dalvikvm(  312): JNI WARNING: JNI method called with exception
raised
W/dalvikvm(  312):              in Ldalvik/system/NativeStart;.run ()V
(GetMethodID)
W/dalvikvm(  312): Pending exception is:
I/dalvikvm(  312): Ljava/lang/NoClassDefFoundError;: [generic]
I/dalvikvm(  312):  at dalvik.system.NativeStart.main(Native Method)
I/dalvikvm(  312): "Thread-8" prio=5 tid=7 NATIVE
I/dalvikvm(  312):   | group="main" sCount=0 dsCount=0 s=N
obj=0x43e40090 self=0x225260
I/dalvikvm(  312):   | sysTid=332 nice=0 sched=0/0 cgrp=default
handle=2183472
I/dalvikvm(  312):   | schedstat=( 9266339 26373662 8 )
I/dalvikvm(  312):   at dalvik.system.NativeStart.run(Native Method)
I/dalvikvm(  312):
E/dalvikvm(  312): VM aborting


Has anyone seen this error? I couldn't find anywhere on google about
this. I am new to java and so to JNI so don't know what exactly is
going wrong. Can anyone help me?

Thanks.

P.S. Its a little bit urgent. :)

-- 

2. Airplane mode & scheduling of PendingIntent(s) problems (Froyo Android OS 2.2).

Hello, does anyone know if on Android 2.2 if placed in Airplane mode does not 
start scheduled Intent(s) with AlarmManager through PendingIntent(s)?

More simply: An alarm will sound if when play is in airplane mode?
I hope that I explained.
Thanks you!Giuseppe.


      

-- 

3. what does this monkey script do??

4. intent filters created at runtime

5. Changing view after softkeypad has slided in

6. List of bugs on the issue which should be marked as resolved

7. How to broadcast date change message in application