[android-developers] Why Android Studio IDE shows redundant modules in "Project View" pane

2016-08-11 Thread Toothy Bunny
Hi,

I opened Google's NDK sample "Teapot" project in Android Studio 2.1. 
Everything works well except one thing confuses me.

The "Teapot" project contains two modules "App" and "NativeActivity". Under 
"Project View" in the left-hand pane, I saw two "redundant node" of "app" 
and "NativeActivity" are shown side-by-side with project node "Teapot". 
While other projects shows only the project node as the single root node 
and all modules shown under it. See attached screenshot.

Is there a way to get rid of these two redundant nodes in the "Project 
View" or they do have special meaning?



-- 
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 https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/74325f84-59b0-4883-ac85-1d67fe3c3446%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[android-developers] OpenGL App crashes on Nexus One

2010-02-02 Thread Toothy Bunny
Hi All,
Do not know anybody could give a hint for the problem I have. Our
OpenGL games are built based on SDK 1.2 and runs almost all Android
devices (from OS 1.2 ~ 2.0) except Google Nexus One (OS 2.1). On Nexus
One, it generates the following exception:

02-01 09:26:28.319: DEBUG/libEGL(2340): loaded /system/lib/egl/
libGLES_android.so
02-01 09:26:28.319: DEBUG/libEGL(2340): loaded /system/lib/egl/
libEGL_adreno200.so
02-01 09:26:28.329: DEBUG/libEGL(2340): loaded /system/lib/egl/
libGLESv1_CM_adreno200.so
02-01 09:26:28.329: DEBUG/libEGL(2340): loaded /system/lib/egl/
libGLESv2_adreno200.so

02-01 09:26:28.349: ERROR/qsd8k.gralloc(2340): invalid gralloc handle
(at 0x140a48)
02-01 09:26:28.349: ERROR/Adreno200-EGL(2340): eglLockWindowSurface
439: lock failed
02-01 09:26:28.349: ERROR/qsd8k.gralloc(2340): invalid gralloc handle
(at 0x140a48)
02-01 09:26:28.349: ERROR/Adreno200-EGL(2340): eglLockWindowSurface
444: unlock failed
02-01 09:26:28.349: ERROR/Adreno200-EGL(2340): eglLockWindowSurface:
failed to map the memory for fd=28 offs=3
02-01 09:26:28.349: ERROR/qsd8k.gralloc(2340): invalid gralloc handle
(at 0x140a48)
02-01 09:26:28.349: ERROR/Adreno200-EGL(2340): eglLockWindowSurface
439: lock failed
(The same error messages repeats for ever inside the animation
loop...)

We are using our own SurfaceView (almost same as GLSurfaceView) and I
believe we got the correct  EGLContext (otherwise a NULL EGLContext
error message will pop out). The problem is that the same code runs on
about 10 different Android phones from OS 1.2 to 2.0 (including Moto
Droid) but failed on Nexus. Any body at Android OpenGL team could give
a suggestion on the error message?

Hongkun
OmnigSoft


-- 
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


[android-developers] How can we restart an Activity properly?

2009-01-02 Thread Toothy Bunny

Hi All,
I created a restart() method to restart an Activity, there are some
reasons for us to do this since there are some thing that we can not
do unless we make the Activity completely restarted, for example, if
the SurfaceView is created in GPU memory and we want to move it back
to normal memory, than we have to restart the Activity.
Anyway, the following cod is our implementation of restart():

public void restart(String commandLineArguments)
{
Intent intent = new android.content.Intent();
intent.setClass(this, this.getClass());  //We will start the
Activity itself, not any other
this.startActivity(intent);
//this.finish(); //I need to remove this
line, otherwise the new Activity will just live for a short moment.
}

The code is almost same as the SDK sample cod from Forwarding.java
except the last line this.finish(). If we have this line, then the
newly started Activity will be shut down too (why?). After I
eliminated this line, a new Activity is started successfully but the
old activity is still inside of the Activity Stack, as the result,
there going to be numbers of instance of same Activity in the Activity
stack.

So the question is: how to properly kill previous Activity in the
newly launched Activity? Or, in other words, how can a Activity knows
who launched me? and need to terminate it I tried to use Intent, but
could not find a suitable function.

Many thanks for any suggestions.
Hongkun
www.omnigsoft.com

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: How can we restart an Activity properly?

2009-01-02 Thread Toothy Bunny

Just want to add one more thing:
I printed out the instance count by this.getInstanceCount(), the
result is that the instance count is increased once the restart() is
called, like 1, 2, 3, ..., which means the old instance is not killed.
We need to kill the old instance in the newly restarted Activity.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] T-Mobile G1: How to properly resume View's focus when Activity resumed from screen black-out?

2008-12-31 Thread Toothy Bunny

Hi All,
If the G1 is idle for short period (no user input) while a Activity is
still running, the screen blacks out and the user input is locked.
When the screen is unlocked by the user again and screen light up, we
found the View object does not have input focus, as the result, the
application does not react any user input.

To solve this App. frozen problem, I added View.request() in
Activity's onResume() method becase onResume() is called when the
Activity comes back after screen black-out.

Also, is there a way to completely avoid screen black-out, in other
words, how can we make the screen always on when a Activity is running
even there is no user input.

Thanks for any suggestions!
Hongkun
www.omnigsoft.com

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: OpenGL on T-Mobile G1: How to turn OpenGL on and off with SurfaceHolder ?

2008-12-26 Thread Toothy Bunny

Hi Mathias,
Thanks for your suggestion. I think you misunderstood my question. I
am not asking about how to make 2D and 3D rendering working together
on the same surface at the same time, in fact, we are not mixing
lockCanvas()/UnlockCanvasAndPost() with OpenGl eglMakeCurrent()/
eglSwapBuffers() on the same Surface at the same time.
What we did is: with a single Surface, set up an internal flag like
boolean surfaceBoundToOpenGL. When this flag is set to false, means
we are doing 2D rendering on the surface, let the rendering pipeline
go through the lockCanvas()/UnlockCanvasAndPost(). When this flag is
set to true, means we are doing 3D rendering, then the rendering
pipeline go through the eglMakeCurrent()/eglSwapBuffers().

This solution is working perfectly on both emulator and G1. The only
issue left is once the surface is bound to OpenGL, we are unable to
un-bind it from OpenGL when we quit from 3D game session and let 2D
rendering working again. This problem only happens on G1 since the
surface is created on GPU memory.

So the question actually is: how can we tell OpenGL to completely
release the surface when 3D rendering is done and we would like to go
back to 2D.

If you want, I can send you the APK file of our X-benchmark, from
which you can see that on emulator, we successfully enter and quit 3D
rendering with the above solution.

Hongkun
www.omnigsoft.com


On Dec 26, 7:10 pm, Mathias Agopian pixelflin...@google.com wrote:
 Hi,

 On Dec 26, 5:00 am, Toothy Bunny hongkun...@gmail.com wrote:



  Hi All,
  When designing a 3D game running on Android, we need to enter into 3D
  (OpenGL) rendering and quit back to 2D rendering from time to time,
  like this control flow: game title page (2D) - game main menu (2D) -
  game window (3D / OpenGL) - game main menu (2D).
  We have made this working well on the emulator by following the design
  pattern required by SurfaceView:

  1) For 2D rendering:
  Canvas c = _surfaceHolder.lockCanvas();
  //Do 2D rendering with canvas
  _surfaceHolder.unlockCanvasAndPost(c);

  2) After entering 3D (OpenGL) rendering:
  egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);
  //Do OpenGL rendering
  egl.eglSwapBuffers(eglDisplay, eglSurface);

 Unfortunately, It is not currently possible to mix and match lockCanvas
 () with eglSwapBuffers().

 I would recommend to simply use a regular view to do the 2D rendering.
 You can have a regular view on top of the SurfaceView you use for
 OpenGL (use a layout to stack them up), and simply show and hide the
 2D view when needed.
 This requires that the 2D rendering be done in the UI thread though;
 but it will be more efficient and this has the advantage that you can
 use any widget you want (like buttons).

  This works well on the emulator. However on T-Mobile G1 phone,
  entering 3D (OpenGL) from 2D does not have any problem, but when exit
  3D back to 2D, the G1's screen content remained with the last OpenGL
  rendering and no any 2D rendering can be added on the Surface.
  I think the reason is because we set the Surface type as
  SurfaceHolder.SURFACE_TYPE_GPU when we create the surface. When I
  quit from OpenGL, I tried to change the surface type back to
  SurfaceHolder.SURFACE_TYPE_NORMAL but it general IllegalArgument
  Exception. I guess it is because Android Surface does not allow to
  change its type dynamically.

 Exact.

  So my question is: how can we properly exit from OpenGL and make the
  Surface work again with all 2D rendering? Is there a way to re-create
  the surface of the View object?

  By the way, my OpenGl clean-up code is exactly same as the
  GLSurfaceView sample code, it should have any problem.

  Many thanks for any suggestions!
  Hongkunwww.omnigsoft.com

 I hope this helps.

 Mathias
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] OpenGL on T-Mobile G1: How to turn OpenGL on and off with SurfaceHolder ?

2008-12-25 Thread Toothy Bunny

Hi All,
When designing a 3D game running on Android, we need to enter into 3D
(OpenGL) rendering and quit back to 2D rendering from time to time,
like this control flow: game title page (2D) - game main menu (2D) -
game window (3D / OpenGL) - game main menu (2D).
We have made this working well on the emulator by following the design
pattern required by SurfaceView:

1) For 2D rendering:
Canvas c = _surfaceHolder.lockCanvas();
//Do 2D rendering with canvas
_surfaceHolder.unlockCanvasAndPost(c);

2) After entering 3D (OpenGL) rendering:
egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext);
//Do OpenGL rendering
egl.eglSwapBuffers(eglDisplay, eglSurface);

This works well on the emulator. However on T-Mobile G1 phone,
entering 3D (OpenGL) from 2D does not have any problem, but when exit
3D back to 2D, the G1's screen content remained with the last OpenGL
rendering and no any 2D rendering can be added on the Surface.
I think the reason is because we set the Surface type as
SurfaceHolder.SURFACE_TYPE_GPU when we create the surface. When I
quit from OpenGL, I tried to change the surface type back to
SurfaceHolder.SURFACE_TYPE_NORMAL but it general IllegalArgument
Exception. I guess it is because Android Surface does not allow to
change its type dynamically.

So my question is: how can we properly exit from OpenGL and make the
Surface work again with all 2D rendering? Is there a way to re-create
the surface of the View object?

By the way, my OpenGl clean-up code is exactly same as the
GLSurfaceView sample code, it should have any problem.

Many thanks for any suggestions!
Hongkun
www.omnigsoft.com

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Suggestions Needed: can not play sound files under assets folder

2008-12-22 Thread Toothy Bunny

Hi All,
I have been struggling with playing a WAV file music.wav under
assets folder of my APK file. The WAV file has been proven good by
using Android SDK's media sample code.

I tried the following methods, all of them generates
java.io.IOException: Prepare failed.: status=0xFFFC.

Method 1 - mediaplayer.setDataSource(file:///android_asset/
music.wav);

Method 2 - mediaplayer.setDataSource(myActivity.getAssets().openFd
(music.wav).getFileDescriptor());

Method3 - First, write a temporary wav file under data/data/myAppName/
files/ by opening an InputStream / OutputStream with AssetManager,
then use mediaplayer.setDataSource(data/data/myAppName/files/
music.wav);  From Adroid file explorer I can even see that the
temporary wav file is created successfully, but prepare() still
generates IOException.

The only way I can play this wav file is I manually push this wav file
onto the emulator, say data/data/myApp, then I use a hard-coded
string to call setDataSource(), but sadly we can not use a hard-coded
string to play sound effect.

Can anyone help me out to play sound files (wav, mp3) under APK
assets folder? Or is there a way to set the data source by an
InputStream directly?

Many thanks for any suggestions!
Hongkun
www.omnigsoft.com





--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Re: Suggestions Needed: can not play sound files under assets folder

2008-12-22 Thread Toothy Bunny

Hi All,
After searching developer group, I found out the problem might be
related to the file permission, because Android Media player does not
have permission to access application's data directory.
Here is another developer's post about Media Player's problem.
Hongkun
www.omnigsoft.com

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[android-developers] Canvas.drawBitmap(int[] colors, ...) creates wrong alpha blending

2008-12-10 Thread Toothy Bunny

Hi All,
I'm trying to use Canvas.drawBitmap(int[] colors, int offset, int
stride, int x, int y, int width, int height, boolean hasAlpha, Paint
paint) to draw an integer color array containing an image pixels array
in the format of ARGB_ (with alpha channel).

This function is provided in SDK 1.0 to draw a color pixel array
directly without creating an intermediate Bitmap. However, I found
this function does not perform alpha blending at all.

The attached picture is the screen shot of my test result. Left screen
shot is the correct result if I create a Bitmap from the color array
first then draw the created Bitmap. Right screen shot is the wrong
result if I draw the color array directly. I noticed in the wrong
rendering, all pixels are treated as either completely opaque or
completely transparent. if a pixel has a alpha value other than 0xFF
or 0x00 (translucent pixel), it will be rendered incorrectly.

I hope anyone in Android team can give some suggestions for this
issue. I'm currently thinking this is a bug.

Hongkun
OmniGSoft

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Canvas.drawBitmap(int[] colors, ...) creates wrong alpha blending

2008-12-10 Thread Toothy Bunny

I could not find a way to attach pictures with my post, so I post the
screen shot on the web, and here is the link:

The test screen shot:
http://www.omnigsoft.com/TechnicalSupport/TestResult.png

The original PNG image (with alpha channel) I used for the test:
http://www.omnigsoft.com/TechnicalSupport/pngWithAlpha.png

Hongkun
OmniGSoft

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: How to get a GL11Ext instance to call OpenGL Extension functions?

2008-04-02 Thread Toothy Bunny

Hi Romain,
Thanks for your suggestion.
I'll need to use GL11Ext.drawTexiOES() to draw 2D image in OpenGL
context. I understand that we need to check the availablilty of GL
extension function before we use it. Do you know how to check the
ability? Using glGetString()?
Thanks,
hongkun
www.omnigsoft.com


On Mar 31, 4:12 pm, Romain Guy [EMAIL PROTECTED] wrote:
 Hi,

 Yes, a cast is all you need.





 On Mon, Mar 31, 2008 at 1:09 PM, Toothy Bunny [EMAIL PROTECTED] wrote:

   Hi Android Graphics Team,
   I would like to call OpenGL extension function:
   void glDrawTexiOES(int x, int y, int z, int width, int height)

   to render a 2D image directly in 3D scene without bothering to use
   OpenGL quad.

   The question is, how can I get aGL11Extinstance? I could not find
   any function to do this.
   Does this means I can simply cast the instance returned by
   OpenGLContext.getGL() into aGL11Ext?

   Thanks,
   Hongkun
   www.omnigsoft.com

 --
 Romain Guywww.curious-creature.org- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] How to get a GL11Ext instance to call OpenGL Extension functions?

2008-03-31 Thread Toothy Bunny

Hi Android Graphics Team,
I would like to call OpenGL extension function:
void glDrawTexiOES(int x, int y, int z, int width, int height)

to render a 2D image directly in 3D scene without bothering to use
OpenGL quad.

The question is, how can I get a GL11Ext instance? I could not find
any function to do this.
Does this means I can simply cast the instance returned by
OpenGLContext.getGL() into a GL11Ext?

Thanks,
Hongkun
www.omnigsoft.com

--~--~-~--~~~---~--~~
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
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---