Difference in iOS OpenGl ES and Android OpenGl Es

I am wondering what the difference (if any) there is in OpenGl ES for Android and OpenGl ES for iOS


OpenGLES API for Android have many unsported API and any problems.
For instance, glColorub, glPointParameterfv, point sprite OES(Extension) APIs, and so on.
And, Xpreia(android device) have glFlush bug.
When glFlush used, occurred display noise.

OpenGLES API for Android implementation is asunder each devices.


Does SoftReference calls .recycle() on Bitmap object

If I store bitmaps in a hashmap using SoftReference, will SoftReference call .recycle() on the Bitmap ? And if it doesn’t then what would be a way to clear the bitmap properly from memory under the given situation (when bitmaps are inside a HashMap) ?


If I store bitmaps in a hashmap using SoftReference, will SoftReference call .recycle() on the Bitmap ?

No. What if instead of a Bitmap you store a String or a POJO? Do they have the recycle method? Of course no. So, the question is: what’s SoftReference for?

You use a SoftReference when you want the referenced object to stay alive until the host process is running low on memory. The object will not be eligible for collection until the collector needs to free memory. Loosely stated, binding a SoftReference means, “Pin the object until you can’t anymore.” (link)

You don’t have to care about clearing the Bitmap (invoking the recycle method); just let the SoftReference do its work.


How to save a JPEG image on Android with a custom quality level

On Android, how do I save an image file as a JPEG at 30% quality?

In standard Java, I would use ImageIO to read the image as a BufferedImage, then save it as a JPEG file using an IIOImage instance: It appears, however, that Android lacks the javax.imageio package.


You can store your bitmap in the JPEG format by calling compress and setting the second parameter:

    Bitmap bm2 = createBitmap();
    OutputStream stream = new FileOutputStream("/sdcard/test.jpg");
    /* Write bitmap to file using JPEG and 80% quality hint for JPEG. */
    bm2.compress(CompressFormat.JPEG, 80, stream);

Android Graphics Internals

I haven’t found a clear explanation on how the Android graphics system works, specifically, does it use a display server, is it based on DirectFB or X11, etc.

From what I’ve managed to piece together, Android depends on the Linux frame buffer. I haven’t found much on what sort of display server or window manager Android uses to multiplex access to the framebuffer though, so any pointers would be much appreciated!

Finally, from what I understand the ARM instruction set provides instructions to accelerate OpenGL, but how this integrates with the display server isn’t clear, ie. do client applications negotiate a shared memory buffer into which the client writes directly?

Are the OpenGL libraries for the platform accelerator open source? I’ve found some references suggesting they’re closed source binaries. Again, any pointers would be appreciated.


There are two core pieces to Android graphics: SurfaceFlinger and Skia. SurfaceFlinger is Android’s compositor, used by the window manager to create and display windows (actually called surfaces.) SurfaceFlinger is implemented on top of OpenGL ES 1.x currently and can also use other hardware acceleration techniques when available (MDP, a 2D blitter on the T-Mobile G1, or hardware overlays on the Xoom.)

Each application renders into its windows (or surfaces) using primarily Skia. Skia is Android’s 2D graphics library. You can also use OpenGL ES 1.x and 2.0 to render into a surface.

Android doesn’t use DirectFB or X11 or any other existing Linux solution.


Greek String doesn’t match regex when read from keyboard

public static void main(String[] args) throws IOException {
   String str1 = "ΔΞ123456";
   System.out.println(str1+"-"+str1.matches("^\p{InGreek}{2}\d{6}")); //ΔΞ123456-true

   BufferedReader br = new BufferedReader(new InputStreamReader(;
   String str2 = br.readLine(); //ΔΞ123456 same as str1.
   System.out.println(str2+"-"+str2.matches("^\p{InGreek}{2}\d{6}")); //Δ�123456-false

   System.out.println(str1.equals(str2)); //false

The same String doesn’t match regex when read from keyboard.
What causes this problem, and how can we solve this?
Thanks in advance.

EDIT: I used System.console() for input and output.

public static void main(String[] args) throws IOException {
        PrintWriter pr = System.console().writer();

        String str1 = "ΔΞ123456";

        String str2 = System.console().readLine();





If you use Windows, it may be caused by the fact that console character encoding (“OEM code page”) is not the same as a system encoding (“ANSI code page”).

InputStreamReader without explicit encoding parameter assumes input data to be in the system default encoding, therefore characters read from the console are decoded incorrectly.

In order to correctly read non-us-ascii characters in Windows console you need to specify console encoding explicitly when constructing InputStreamReader (required codepage number can be found by executing mode con cp in the command line):

BufferedReader br = new BufferedReader(
    new InputStreamReader(, "CP737")); 

The same problem applies to the output, you need to construct PrintWriter with proper encoding:

PrintWriter out = new PrintWrtier(new OutputStreamWriter(System.out, "CP737"));

Note that since Java 1.6 you can avoid these workarounds by using Console object obtained from System.console(). It provides Reader and Writer with correctly configured encoding as well as some utility methods.

However, System.console() returns null when streams are redirected (for example, when running from IDE). A workaround for this problem can be found in McDowell’s answer.

See also:

Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..