I have a routine like this... void SetNativeWindowHandle( ANativeWindow *displayWindow ) { _32 new_w, new_h; _32 real_h; //lprintf( "Setting native window handle... (shouldn't this do something else?)" ); l.displayWindow = displayWindow;
new_w = ANativeWindow_getWidth( l.displayWindow); new_h = (real_h = ANativeWindow_getHeight( l.displayWindow) ) } It gets called from with engine.app->pendingWindow works pretty good. The only problem I found with the functions is if you use a very old SDK target you will get false numbers... but then android is auto scaling for you... so your surface is reallly that width and height to the app view and it's auto scaled to the correct resolution. On Wed, Dec 2, 2015 at 10:14 PM, fei wang <philip584...@gmail.com> wrote: > Hi guys, > > How can i layout text(get the width and height) from c/c++ and in non-UI > thread? > > I have been developing a dynamic layout engine(written in c) which takes > html(css + dom tree) as input and generates a native android view. > The key point of affecting the performance is the must layout process in > java layer(new TextView or Html.from + TextView.setText() + > TextView.measure()) which can't execute on non-UI thread > and can't be done directly from c. > > BR, > fay > > -- > 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. > To post to this group, send email to android-developers@googlegroups.com. > Visit this group at http://groups.google.com/group/android-developers. > To view this discussion on the web visit > https://groups.google.com/d/msgid/android-developers/4a658df0-6ae5-45b6-9d37-fa6f49503829%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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. To post to this group, send email to android-developers@googlegroups.com. Visit this group at http://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/CAA2GJqXEycA%2B9vz65L6L_U7hQD%3DD2C7-xzNVRvAUYODW3T_cAg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.