Error trying to use XML Layout and extended GLSurfaceView

by Kostya Vasilyev » Thu, 06 May 2010 04:57:49 GMT

Sponsored Links
 ust a wild guess. Could be wrong.

Perhaps when Android views are instantiated from XML, there is a parser
involved, and at construction time it is positioned at that view's XML tags.

Then it's time to instantiate the view's children, and they are in turn
passed "bridge" XML parsers that appear to represent complete XML file, but
in fact are made to look at just the portion of the original XML file that
corresponds to the children.

Somewhere in there is support for <merge> tag, and other niceties that
Android provides in its XML layout support.

Perhaps you could look at Android source, and investigate constructors of
various Views (esp. ViewGroup and subclasses) that deal with loading from
XML, and see what they do with their arguments before calling super(....).

-- Kostya

2010/5/6 Jeremiah Sellars <>


Other Threads

1. problem with OutputStream.flush() not working

I am sending jpg images via TCP, using InputStream and OutputStream:

  //  Note that valid outStream and inStream variables have been
established and passed to the
  //  picTransmit method

          public picTransmit(Bitmap sendBitmap, OutputStream
                    InputStream inStream) {
                // First, send the sendBitmap
               sendBitmap.compress(Bitmap.CompressFormat.JPEG, 80,
               try {
                    outStream.close();    //<-- using this works to
force pic to be sent
                    // outStream.flush();  //<-- using this code
instead (without the "//") ,
                                                  // should force pic
to be sent...  but it doesn't.
               } catch (IOException e) {

                // Second, receive an incoming Bitmap
               Bitmap receiveBitmap = BitmapFactory.decodeStream
(inStream);  // this throws
                        // "Bad socket error, if you call
outStream.close() up above.

//  Do more stuff...


The first part where the picture is sent works, but only if I use the
outStream.close() code.  If I try to use outStream.flush(), nothing
happens and the IO just hangs.  This I don't understand.
I have tried using BufferedOutputStream and BufferedInputStream but
the behaviour is the same.

Unfortunately, when I use outStream.close(), it means that my
subsequent call to inStream later, resuts in a "Bad Socket" error. I
am not sure why if I close the outStream, the inStream is also screwed
up, but I have seen others make reference to this in other internet

So I have a catch-22, I can only get the first send-picture to work if
I use outStream.close() and if I use outStream.close(), I have no way
of getting the second part (where I receive a picture) to work.

Any ideas about how to structure a send then receive of image data via
TCP would be appreciated since this seems to be a dead end.



2. Trouble with BitmapFactory.decodeResource

I use this line:

mIcon = BitmapFactory.decodeResource(context.getResources(),

after which mIcon is not null, but its width and height are both -1
and nothing is drawn.  Is there something obvious that I'm missing?

Here's my call to draw it:

canvas.drawBitmap(mIcon, null, new Rect(loc.x-16, loc.y+16, loc.x+16,
loc.y-16), mPaint);


3. Android Beginners <>

4. WAV (GSM 6.1) Support?

5. Adding static non scroll areas when using a list view.

6. Communication protocol question

7. How do you step through (debug) from the Java layer into the Linux layer?