Layout not displayed properly while loading Listview dynamically?

by javame_android » Thu, 22 Apr 2010 17:48:19 GMT


Sponsored Links
 Hi,

I am trying to laod the listview dynamically. There are three
textviews inside a listview. The text to be set in the textview is
fetched from the server. All this is working fine. I am able to fetch
the text and am able to display it inside the listview.

The only problem is the position of the textview. The xml layout file
is as under :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android=" http://schemas.android.com/apk/res/ 
android"
        android:id="@+id/listViewShow"
    android:layout_width="fill_parent"
    android:layout_height="?android:attr/listPreferredItemHeight"
    android:background="@drawable/brown_bg"
    android:padding = "3dip">

    <TextView
        android:id = "@+id/txtBabbleListTitle"
                android:layout_width = "wrap_content"
                android:layout_height = "wrap_content"
                android:textColor = "#000000"
                android:text = "Hello">
    </TextView>

    <RelativeLayout
        android:layout_width = "wrap_content"
        android:layout_height = "wrap_content">

        <TextView
                android:id = "@+id/txtBabbleDateTime"
                        android:layout_width = "wrap_content"
                        android:layout_height = "wrap_content"
                        android:layout_alignParentBottom = "true"
                        android:textColor = "#000000"
                        android:text = "Hello" >
        </TextView>
    </RelativeLayout>

    <TextView
        android:id = "@+id/txtBabbleTotalReplies"
        android:layout_width = "wrap_content"
                android:layout_height = "wrap_content"
                android:layout_alignParentRight = "true"
                android:textColor = "#000000"
                android:text = "(7)">
    </TextView>

</RelativeLayout>

If I look at this xml layout in the eclipse layout tab then it is
displayed properly. Problem occurs only when the text is fetched
dynamically.

Can some one let me know the issue?


Thanks & Regards
Sunil

--



Layout not displayed properly while loading Listview dynamically?

by javame_android » Thu, 22 Apr 2010 21:13:04 GMT


 Hi,

It is solved now.

I was inflating the row.xml in a wrong way.


Regards
Sunil

--


Sponsored Links


Other Threads

1. PostMethod is removed from 1.0?

After I upgraded to 1.0, I found PostMethod is removed. Following is
my old code

HttpClient client = new HttpClient();
PostMethod method = new PostMethod(Constants.serverUrl +function);
method.setParameter(SharedConstants.NAME_EMAIL, userName);
method.setParameter(SharedConstants.NAME_PASS, passWord)
int statusCode=client.executeMethod(method);

I migrated HttpClient to DedaultHttpClient. But what is the new method
for PostMethod?

THanks!

APril
--~--~---------~--~----~------------~-------~--~----~

2. Issues with permissions when using delegation with Content Providers

Hello, All my content providers are accessed via one over arching
provider that delegates to the others based on the contents of the URI
pattern matcher. So below just the one provider "RunBuddyProvider"
There are actually three smaller providers and I have taken steps to
encapsulate their functionality into one content provider. Interacting
with the providers via INSERT and QUERY works fine for the
instrumentation.
But when using live services that interact with activities I can only
use QUERY successfully. Using INSERT, I get:

ERROR/AndroidRuntime(4197): Uncaught handler: thread main exiting due
to uncaught exception
ERROR/AndroidRuntime(4197): java.lang.NullPointerException

This suggests to me that the permission has not been granted for the
application trying to use the content provider. Has anyone used this
technique or anything similar with content providers? Is this just a
permissions issue from the Manifest? I would appreciate any comments
on the implementation.

Hearing that other people have had some success with this technique of
content provider delegation would put my mind at rest that it worked
and allow me to pursue the bug down the security issues side.
Can anyone offer any suggestions?


#
# In more detail, with code:
#

The delegating content provider is registered in the Manifest:
       <provider
            android:name=".provider.RunBuddyContentProvider"
            android:authorities="com.novoda.runbuddy" />

This then instantiates the factory which then delegates to the other
Providers based on the URI pattern matcher.
Th RoutesProvider is the providers I am using in this instance. When
instantiated; I call the provider to insert based on the query. But
this always throws an Uncaught Handler Exception.

# All the involved classes

http://code.google.com/p/runningbuddy/source/browse/trunk/RunningBuddy/AndroidManifest.xml
http://code.google.com/p/runningbuddy/source/browse/trunk/RunningBuddy/src/com/novoda/runbuddy/provider/RunBuddyContentProvider.java
http://code.google.com/p/runningbuddy/source/browse/trunk/RunningBuddy/src/com/novoda/runbuddy/provider/RunBuddyContentProviderFactory.java
http://code.google.com/p/runningbuddy/source/browse/trunk/RunningBuddy/src/com/novoda/runbuddy/provider/RoutesProvider.java
http://code.google.com/p/runningbuddy/source/browse/trunk/RunningBuddy/src/com/novoda/runbuddy/util/DBHelperImpl.java#118
--~--~---------~--~----~------------~-------~--~----~

3. Best practice for seamless, integration authentication?

4. Best practise for naming intent extras

5. Call for Speakers - Emerging Communications 09

6. Are invisible activities possible?

7. Videos on emulator's browser