View in multiple XML files

by Vaibhav Gathibandhe » Sat, 13 Sep 2008 19:46:31 GMT


Sponsored Links
 Hello all,

Is there any way I can put a large view in multiple XML files.

For example, If i have a view consist of TableLayout and under it I have 6
table rows. Those table rows consist of text view, buttons etc.
The first 2 rows are static, i.e. I always show them in this activity.
But I do want to select 2-3 table rows from remaining four table rows,
depending upon some conditions.

I see there is a addContentView() method for such conditions. But then I
have to program my table rows rather than using XML.

So, it is possible that I define those 4 table rows in separate XML files
and just grab the ones that I need at runtime and add to TableLayout.

Please let me know if I am not clear enough.

Thanks in advance.
Vaibhav

--~--~---------~--~----~------------~-------~--~----~



View in multiple XML files

by Romain Guy » Sat, 13 Sep 2008 19:52:14 GMT


 Yes, just put that view in a separate XML file and use the tag
<include layout="@layout/my_table" /> to include it.

On Sat, Sep 13, 2008 at 11:37 AM, Vaibhav Gathibandhe





-- 
Romain Guy
www.curious-creature.org

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. a problem occurs when uninstall preinstalled APIDemo of SDK following the way of troubleshooting

i met a problem when i am following " I can't install ApiDemos apps in
my IDE because of a signing error" according to
http://code.google.com/intl/zh-CN/android/kb/troubleshooting.html#apidemosreinstall.
I changed  the directory to sdk root as it said, and tried to
uninstall the preinstalled APIDemo, and after the command
./adb uninstall com.android.samples
 the screen prints :
DDM dispatch reg wait timeout
Can't dispatch DDM chunk 52454151: no handler defined
Can't dispatch DDM chunk 48454c4f: no handler defined
Failure

I guess it may be relevant to DDM, but I don't know where the exact
false locates. I am using Eclipse under ubuntu 8.10
--~--~---------~--~----~------------~-------~--~----~

2. Service permission and AndroidManifest.xml errors

Hi,

I have created two .apk as client and server. My client Acticity wants
to invoke the Service of my Server .apk. I used the AIDL and IPC
mechanism to communicate betwwen the Client and server.

My Client code was compiled fine but during Server compliation it was
giving bunch of errors as :
02-10 17:40:22.310: WARN/dalvikvm(246): threadid=3: thread exiting
with uncaught exception (group=0x40010e28)
02-10 17:40:22.310: ERROR/AndroidRuntime(246): Uncaught handler:
thread main exiting due to uncaught exception
02-10 17:40:22.330: ERROR/AndroidRuntime(246):
java.lang.RuntimeException: Unable to start activity ComponentInfo
{oem.android.proj2/oem.android.proj2.RemoteServiceBinding}:
java.lang.RuntimeException: Your content must have a ListView whose id
attribute is 'android.R.id.list'
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2140)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2156)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
android.app.ActivityThread.access$1800(ActivityThread.java:112)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
android.os.Handler.dispatchMessage(Handler.java:88)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
android.os.Looper.loop(Looper.java:123)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
android.app.ActivityThread.main(ActivityThread.java:3742)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
java.lang.reflect.Method.invokeNative(Native Method)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
java.lang.reflect.Method.invoke(Method.java:515)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run
(ZygoteInit.java:739)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
dalvik.system.NativeStart.main(Native Method)
02-10 17:40:22.330: ERROR/AndroidRuntime(246): Caused by:
java.lang.RuntimeException: Your content must have a ListView whose id
attribute is 'android.R.id.list'
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
android.app.ListActivity.onContentChanged(ListActivity.java:236)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
com.android.internal.policy.impl.PhoneWindow.setContentView
(PhoneWindow.java:230)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
android.app.Activity.setContentView(Activity.java:1569)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
oem.android.proj2.RemoteServiceBinding.onCreate
(RemoteServiceBinding.java:35)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1122)
02-10 17:40:22.330: ERROR/AndroidRuntime(246):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2103)


=========================

My AndroidManifest.xml file are as below:

Server Manifest file:

<service android:name=".RemoteService"
                  android:label="@string/app_name"
                  android:exported="true"
                  android:enabled="true"
 
android:permission="oem.android.permission.READ_OWNER_DATA">
</service>
    <activity android:name="DisplayPage"></activity>



Client Manifest file:
<uses-permission android:name="android.permission.READ_OWNER_DATA"/>
    <application android:icon="@drawable/icon" android:label="@string/
app_name">
        <activity android:name=".RemoteServiceBinding"
                  android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>


Can some plz help me to resolve the errors.

To communicate between two normal .apks what permission should be
prefered, for time being i am using
android.permission.READ_OWNER_DATA,  is that ok.

-Kumar
--~--~---------~--~----~------------~-------~--~----~

3. ExpandableListAdapter problem

4. Skinning a Spinner

5. Adding native library to SDK

6. How to clear a notification when using a PendingIntent?

7. in-memory live object histogram