setting max height of listview with initial height is wrap content(it may be empty)

by jalandar » Tue, 13 Jan 2009 20:50:32 GMT


Sponsored Links
 Hello everybody I want set initial height of list view with wrap
content, and later it will be expanded as per data added to specific
limit of height. I used wrap_content for height and android:maxHeight
="100px", but it is not working properly the list grows in height
beyond the maxHeight as the list item added.
Is there any other solution.
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. How to draw a rectangle with four edges in different color?

Hi, I am new to Android. Now I am trying to create a rectangle with
four edges of different color as my GriewView's selector. Here is my
codes. But I what I get is a rectangle with four edges in same color.
Anyone can help?

--------------------------------------------------------------------------------------------------------------------------------------------
                Path mPath = new Path();

                ShapeDrawable mSelector = new ShapeDrawable(new PathShape(mPath,
100,100));
                Paint mPaint = mSelector.getPaint();

                mPaint.setColor(0xFFFF0000);
                mPaint.setStyle(Paint.Style.STROKE);
                mPaint.setStrokeJoin(Paint.Join.ROUND);
                mPaint.setStrokeCap(Paint.Cap.ROUND);
                mPaint.setStrokeWidth(1);

                mPath.moveTo(0, 0);
                mPath.lineTo(100, 0);
                mPaint.setColor(0xFFFFFFFF);
                mPath.lineTo(100, 100);

                mPaint.setColor(0xFF3079C4);
                mPath.lineTo(0,100);
                mPaint.setColor(0xFFFFF000);
                mPath.lineTo(0, 0);

                mGridview.setSelector(mSelector);
------------------------------------------------------------------------------------------------------------------------------------------------

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

2. Unable to connect: Cookie Rejected:

The code is as follows: try {
                                                URL link = new 
URL(apiUrl.toString().trim().replaceAll(" ",
"%20"));
                                                Log.i(TAG, "-----URL: 
"+link.toString());
                                                getResponse(link.toString()); 
/*DISPLAYS THE HTTP RESPONSE ON
SCREEN AS DEBUG MESSAGES*/

                                                URLConnection conn = 
link.openConnection();
                                                conn.connect();
                                                BufferedReader in = new 
BufferedReader(new InputStreamReader
(conn.getInputStream()));
                                    String inputLine;
//                                  Log.i
                                    Log.i(TAG, "-----RESPONSE START-----");
                                    while ((inputLine = in.readLine()) != null) 
{
                                        System.out.println(inputLine);
                                    }
                                    in.close();
                                    Log.i(TAG, "-----RESPONSE END-----");
                                        } catch (MalformedURLException e) {
                                                // TODO Auto-generated catch 
block
                                                e.printStackTrace();
                                        } catch (IOException e) {
                                                // TODO Auto-generated catch 
block
                                                e.printStackTrace();
                                        }

The Logcat output is as below:

I/DELICIOUS ADApTER SERVICE( 1280): -----URL: https://ashwin_loves_android%20:th
e2009nissan...@api.del.icio.us/v1/posts/add?url= http://www.***.com/ 
&descripti
on=Google&replace=no
D/InetAddress( 1280): api.del.icio.us: 76.13.6.208 (family 2, proto 6)
D/dalvikvm( 1280): GC freed 10180 objects / 636520 bytes in 165ms
I/dalvikvm( 1280): Uncaught exception thrown by finalizer (will be
discarded):
I/dalvikvm( 1280): Ljava/lang/IllegalStateException;: Finalizing
cursor android.
database.sqlite.sqlitecur...@430ff730 on bookmarks that has not been
deactivated
 or closed
I/dalvikvm( 1280):      at
android.database.sqlite.SQLiteCursor.finalize(SQLiteC
ursor.java:596)
I/dalvikvm( 1280):      at dalvik.system.NativeStart.run(Native
Method)
D/dalvikvm( 1280): GC freed 8351 objects / 592432 bytes in 216ms
D/dalvikvm(  706): GC freed 111 objects / 6128 bytes in 224ms
D/dalvikvm( 1280): GC freed 9159 objects / 478240 bytes in 148ms
D/OpenSSLSessionImpl( 1280): Freeing OpenSSL session
W/ResponseProcessCookies( 1280): Cookie rejected: "[version: 0][name:
delicious_
us_production][value:
0MYX_iTE_WJRglbnXQltmbcAVib9uQ9eKKlGb4iO3.Q7a8n6ymY4p8.P4f
DggPKOhJQHUtYBJLE0b8QhcwLdY_NZCg5jGHuKmMawRibf_owBHCjK4alYXZmkpJnJ4gUFnYjpj2NoXl
upfyK1F.rNL_yT1R_zaXuagaMUK1fBTjtIbNRcyTt3bb72eU4A6yhZaJ3UT_6zIP9v4po64cX3g1i_7o
z6yRMNbG5Mlo5CR6tpE9sh0Unv2uX.
8oUTTQTGlwEuxYx3getYGLP9l_ieTsgZD11bvulWVKs1bqnWeO
mnsh771_PgceCofgqISH.YTkVzEyghFrI-][domain: .delicious.com][path: /]
[expiry: Sat
 Aug 14 14:06:13 PDT 2010]". Illegal domain attribute "delicious.com".
Domain of
 origin: "api.del.icio.us"
I/HTTP GET RESPONSE: ( 1280):
org.apache.http.message.basichttprespo...@43199800

I/HTTP STREAM CONTENT: ( 1280):
org.apache.http.conn.eofsensorinputstr...@430cf9
b0
D/dalvikvm( 1280): GC freed 8024 objects / 523520 bytes in 147ms
D/dalvikvm( 1280): GC freed 8921 objects / 826880 bytes in 148ms
I/ActivityManager(   59): Start proc com.tni.TasKiller for broadcast
com.tni.Tas
Killer/.TaskBarWidget: pid=1474 uid=10029 gids={}
I/dalvikvm( 1474): De{*filter*} thread not active, ignoring DDM send
(t=0x41504e4d l
=38)
I/dalvikvm( 1474): De{*filter*} thread not active, ignoring DDM send
(t=0x41504e4d l
=38)
I/ActivityManager(   59): Process android.process.media (pid 1444) has
died.
W/System.err( 1280): java.lang.NullPointerException
W/System.err( 1280):    at
org.apache.harmony.luni.internal.net.www.protocol.htt
p.HttpURLConnection.readln(HttpURLConnection.java:1181)
W/System.err( 1280):    at
org.apache.harmony.luni.internal.net.www.protocol.htt
p.HttpURLConnection$ChunkedInputStream.readChunkSize
(HttpURLConnection.java:394)

W/System.err( 1280):    at
org.apache.harmony.luni.internal.net.www.protocol.htt
p.HttpURLConnection$ChunkedInputStream.<init>(HttpURLConnection.java:
346)
W/System.err( 1280):    at
org.apache.harmony.luni.internal.net.www.protocol.htt
p.HttpURLConnection.getContentStream(HttpURLConnection.java:1077)
W/System.err( 1280):    at
org.apache.harmony.luni.internal.net.www.protocol.htt
p.HttpURLConnection.doRequestInternal(HttpURLConnection.java:1652)
W/System.err( 1280):    at
org.apache.harmony.luni.internal.net.www.protocol.htt
p.HttpURLConnection.doRequest(HttpURLConnection.java:1547)
W/System.err( 1280):    at
org.apache.harmony.luni.internal.net.www.protocol.htt
p.HttpURLConnection.getInputStream(HttpURLConnection.java:1055)
W/System.err( 1280):    at
org.apache.harmony.luni.internal.net.www.protocol.htt
ps.HttpsURLConnection.getInputStream(HttpsURLConnection.java:257)
W/System.err( 1280):    at
com.android.angel.delicious.gateway.DeliciousUpdateSe
rvice.processPrimaryUser(DeliciousUpdateService.java:155)
W/System.err( 1280):    at
com.android.angel.delicious.gateway.DeliciousUpdateSe
rvice.startUpdateService(DeliciousUpdateService.java:72)
W/System.err( 1280):    at
com.android.angel.delicious.service.DeliciousSyncServ
ice$SyncJob.run(DeliciousSyncService.java:93)
W/System.err( 1280):    at
com.android.angel.delicious.service.WakeWorkManager.p
rocess(WakeWorkManager.java:65)
W/System.err( 1280):    at
com.android.angel.delicious.service.WakeWorkManager.a
ccess$0(WakeWorkManager.java:61)
W/System.err( 1280):    at
com.android.angel.delicious.service.WakeWorkManager$1
.run(WakeWorkManager.java:53)
W/System.err( 1280):    at java.lang.Thread.run(Thread.java:1058)
I/ActivityManager(   59): Stopping service:
com.android.angel.delicious/.service
.DeliciousSyncService
^C

The Null Pointer Exception is cause at this line BufferedReader in =
new BufferedReader(new InputStreamReader(conn.getInputStream()));
This is because the connection was unsuccessful. The important is part
is the Cookie Rejected response before the exception.

This is also a cursor finalize error, but that would have nothing to
do with Http connection, right ?

Any help is appreciated.

Thanks,
Ashwin.

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

3. New and need some help with a bluetooth AND SMS app

4. Video Streaming provided by Google Android???

5. How to localize (translate) android core

6. Does the camera app work on the emulator?

7. Struggling -- Getting exception when clicked on HelloItemizedOverlay