Thank you for proving my point, even the information *you* posted would be
moderately useful to the person who had originally asked the question, v.s.
the answer provided by Guy which had absolutely no bearing on the problem
they were having.

Perhaps you should work on your spelling and grammar before accusing *me* of
sounding like a douche (hypocrisy instance 1).

Perhaps you should *actually read* the original post I wrote before
replying with something that you imply refutes my point when in fact it
actually affirms it(hypocrisy instance 2).

Perhaps you should *actually read* the android source before accusing me of
not doing the same (hypocrisy instance 3).
https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/view/View.java
layout
and forceLayout would do absolutely nothing. If you can handle tracing back
through the relevant methods you'll eventually discover the fact that
proves my point, even if the original poster had actually assigned a layout
to his view that layout would have no effect on a View with no parent.

*"His advice was to call layout directly and  doing that will execute
layout"*
-- REALLY?

*"Everything I just wrote you could easily find in sources, but you are not
up to that task"*
-- I am in fact, and have done so. Although  to be honest I don't recall
seeing any rambling gibberish or broken english in them so I'd have to
disagree on this one (hypocrisy instance 4).

*"which would take like 15 minutes and prove that you assertion were
baseless, but instead you choose to spend 20 minutes on writing stupid
and arrogant accusations, that's also an option I guess." *
*-- You* should probably look up the definitions of arrogant and accusation
before writing stupid and arrogant accusations. I simply pointed out that
his answer did not apply to the question, that's not an accusation, merely
a verifiable fact.

FYI:

A.) Calling layout on a view created in the manner indicated would do
absolutely nothing because it has no layout defined, and is not even a
child view of the window yet. It certainly *wouldn't* *force* the layout,
there is a separate function for that purpose, which in this instance would
also do absolutely nothing.

B.) That is irrelevant anyway, because the answer to this question would
have more appropriately been something along the lines of explaining how to
properly create an OpenGL texture using a bitmap, which most certainly is
NOT to instantiate it from the drawing cache of an empty View instance that
hasn't even been added to the display list yet.

The only response that will disprove *anything* that I've said would be to
take the code that the user originally posted and show me how in the hell
you could apply Guys answer (with no added conjecture) and end up with an
even remotely viable solution to the problem as stated, i.e. a Bitmap
applied to an OpenGL texture.

To suggest that his answer of:

*"If you do this in onCreate(), then the View didn't go through a layout **pass
yet, so its size is null (0 by 0 pixels.) You need to either wait **for the
first layout, or force the layout by calling layout() on the **View. "*

would apply to the original question included below would be simply
idiotic. Furthermore I firmly believe that if Guy swallowed his pride and
actually gave it some thought he would eventually agree with me.

> Hello everybody.
>
> I am working with OpenGL and Android, and I was wondering if there is
> any way to create a Bitmap or a Drawable using a view (layout). The
> purpose is to use this Bitmap as Texture for an OpenGL figure.
>
> All I have untill now is:
>
> ** I create a new view from the context and the Id.
>
> View l = new View(context);
>
> l.findViewById(R.layout.main);
>
> ** I used DrawingCache...but dont know if it is well used:
>
> l.setDrawingCacheEnabled(true)**;
>
> Bitmap bmp = l.getDrawingCache();
>
> this bmp is null...


On Sun, Jan 27, 2013 at 4:07 AM, a1 <arco...@gmail.com> wrote:

> W dniu niedziela, 27 stycznia 2013 04:04:22 UTC+1 użytkownik Justin Buser
> napisał:
>
> I did actually, not that it's really relevant. I also looked back through
>> the aosp commit logs and found a grand total of 1 commit that he made, but
>> that's not really relevant either as it doesn't really PROVE anything... My
>> frustration was based on the fact that I was looking for a solution to a
>> problem, and found almost exactly the same couple of paragraphs that he
>> posted here in several other places as well, all of which were pertaining
>> to different problems, and none of those problems were related to the
>> information he was providing.
>>
>
> You probably wouldn't sound like total (frustrated) douchebag if you know
> what you are saying. Romain advice was of course correct, and your comment
> about forceLayout() just proves you have no idea what you are talking about.
>
> Layout is normally done in layout pass, before drawing, and (because
> layout is time consuming) it only perform when needed (that is when view is
> marked as being eligible for layout). So requestLayout and forceLayout just
> marks view to execute layout pass (and indeed will never be executed if
> view is not inside view hierarchy) but Romain never suggested to call
> forceLayout.
> His advice was to call layout directly and  doing that will execute layout
> - that is will calculate position and size of view and will setup drawing
> cache bitmap if enabled.
> Everything I just wrote you could easily find in sources, but you are not
> up to that task (Android sources could be sometimes hard to read), you
> could make a simple test:
>
> package com.test.layout;
>
> import android.app.Activity;
> import android.graphics.Bitmap;
> import android.os.Bundle;
> import android.util.Log;
> import android.widget.ImageView;
>
> public class MainActivity extends Activity {
>
>     @Override
>     protected void onCreate(Bundle savedInstanceState) {
>         super.onCreate(savedInstanceState);
>         setContentView(R.layout.activity_main);
>
>         ImageView v1 = new ImageView(this);
>
> v1.setImageDrawable(getResources().getDrawable(R.drawable.ic_launcher));
>         v1.setDrawingCacheEnabled(true);
>         Bitmap b1 = v1.getDrawingCache();
>
>         ImageView v2 = new ImageView(this);
>
> v2.setImageDrawable(getResources().getDrawable(R.drawable.ic_launcher));
>         v2.setDrawingCacheEnabled(true);
>         v2.layout(0, 0, 200, 200);
>         Bitmap b2 = v2.getDrawingCache();
>
>         if (null != b1) {
>             ((ImageView) findViewById(R.id.imageView1)).setImageBitmap(b1);
>         } else {
>             Log.d("TEST", "Cannot get bitmap1");
>         }
>         if (null != b2) {
>             ((ImageView) findViewById(R.id.imageView2)).setImageBitmap(b2);
>             Log.d("TEST", "Wow it works, it's probably a miracle");
>
>         } else {
>             Log.d("TEST", "Cannot get bitmap2");
>         }
>     }
> }
>
> which would take like 15 minutes and prove that you assertion were
> baseless, but instead you choose to spend 20 minutes on writing stupid
> and arrogant accusations, that's also an option I guess.
>
> --
> Bart
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
>
>



-- 


-- NOT Sent from an iPhone --

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to