Android : Need To Create Bitmap From Integer Array In C / OpenGL

Nov 29, 2009

I am trying to move my code from Java to C, and I have encountered a problem while trying to find a function in C that can take an array of ints and create a bitmap from it for OpenGL. In Java, I used

bitmap = Bitmap.createBitmap( {int array name} , w, h, Config.RGB_565);

Is there a similar function that I can use in C, or a workaround that I could use?

Also, if it matters, I am programming for Android.

Android : Need to Create bitmap from integer array in C / OpenGL


Android : Way To Create Byte Array From Bitmap?

Jul 20, 2009

Is it possible to create a byte array from bitmap?How can I do so?

View 3 Replies View Related

Android : Sax Parser Character Array To Integer?

Apr 4, 2010

I am trying to get the contents of tags into variables in my java Sax parser. However, the Characters method only returns Char arrays. Is there anyway to get the Char array into an Int? code...

View 1 Replies View Related

Android : Spinner Cannot Load An Integer Array / Way To Fix

Apr 19, 2010

I have an application, which has a Spinner that I want populated with some numbers (4,8,12,16). I created an integer-array object in strings.xml with the items mentioned above, set the entries of the Spinner to the integer-array, and when I run the app I get:

04-19 23:38:48.016: ERROR/AndroidRuntime(10193): java.lang.NullPointerException
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:355)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.widget.AbsSpinner.onMeasure(AbsSpinner.java:198)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.view.View.measure(View.java:7965)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2989)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:888)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.widget.LinearLayout.measureVertical(LinearLayout.java:350)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.view.View.measure(View.java:7965)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2989)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.view.View.measure(View.java:7965)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.widget.LinearLayout.measureVertical(LinearLayout.java:464)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.view.View.measure(View.java:7965)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:2989)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.view.View.measure(View.java:7965)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.view.ViewRoot.performTraversals(ViewRoot.java:763)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.view.ViewRoot.handleMessage(ViewRoot.java:1632)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.os.Handler.dispatchMessage(Handler.java:99)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.os.Looper.loop(Looper.java:123)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at android.app.ActivityThread.main(ActivityThread.java:4310)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at java.lang.reflect.Method.invokeNative(Native Method)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at java.lang.reflect.Method.invoke(Method.java:521)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
04-19 23:38:48.016: ERROR/AndroidRuntime(10193): at dalvik.system.NativeStart.main(Native Method)

As soon as I changed the array to a string-array, this works fine. Is this normal? I realize that I can (and will) just convert the string array values to an int, but it seems weird that I have to.

View 1 Replies View Related

How To Write Integer Array To Textview

Apr 11, 2013

how to write integer array to textview,what i tried is

int [] s = getIntent().getIntArrayExtra("ar");
for(int i=0;i<s.length;i++)
chars = (" "+s[i]).toCharArray();
String se = String.valueOf(chars);
tv.setText(se);

View 10 Replies View Related

Android :: Setting Intent Extra Value That's An Array Of String And Integer

Aug 3, 2010

I have a program that sends a broadcast Intent that needs an "extra" value.The value is declared as being of type Object[], though I know that the elements are always of type Integer or String.That's part of an API not under my control. What's the most concise and/or efficient way to do the equivalent of the putExtra call below?

View 6 Replies View Related

Android : Get An Integer Array From Axml Resource In Droid Program?

Jan 14, 2010

I have an xml resource in res/values/integers.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer-array name="UserBases">
<item>2</item>
<item>8</item>
<item>10</item>
<item>16</item>
</integer-array>
</resources>

and ive tried several things to access it:

int[] bases = R.array.UserBases;

this just returns and int reference to UserBases not the array itself

int[] bases = Resources.getSystem().getIntArray(R.array.UserBases);

and this throws an exception back at me telling me the int reference R.array.UserBases points to nothing

what is the best way to access this array, push it into a nice base-type int[] and then possibly push any modifications back into the xml resource.

I've checked the android documentation but I haven't found anything terribly fruitful.

View 1 Replies View Related

Android :: Create Mutable Bitmap From Camera - Draw Another Bitmap On Top - And Save It

Apr 2, 2009

I am 1) taking a picture and 2) then draw another Bitmap on top of it 3) then I store it

I am doing it as follows and it works on the emulator.

On the device I get a OutOfMemoryError: bitmap size exceeds VM budget android.graphics.Bitmap.nativeCopy(Native Method) android.graphics.Bitmap.copy(Bitmap.java:199) in the line copy the Bitmap to get a mutable Bitmap.

CODE:...........

What I am asking:

a) Is there a better way to do what I am doing? 1) take a picture 2) draw another Bitmap on top of it 3) then I store it

b) What is the best way to create a mutable Bitmap from the picture I just took with the camera?

In my app, resolution is not an issue. If it works better for small photos that would be fine.

View 3 Replies View Related

Android : How To Convert Byte Array In Bitmap?

Mar 19, 2009

I want to store image in sqlite database. I tried to store it using BLOB and String, in both cases it store the image and can retrieve it but when i convert it to Bitmap using BitmapFactory.decodeByteArray(...) it return null. Below is my code please have a look and suggest me where i m making mistake.

View 3 Replies View Related

Android : How To Convert Bitmap To Byte Array?

Aug 12, 2010

Does anyone know how to convert a bitmap to a byte array?

View 2 Replies View Related

Android : How Convert Bitmap To Byte Array?

May 29, 2009

I want to store pictures from the internet in my data base as byte arrays. I get the pictures as bitmaps, but can't find way to convert it to byte array.

View 4 Replies View Related

Android :: Draw A Bitmap - Using OpenGL

Aug 30, 2010

I have a byte array of RGB values, just like the contents(without header) of a *.bmp file. What I want to do is, draw the corresponding bitmap on Android, using OpenGL.

It seems that OpenGL ES doesn't have a single API that will do, it true?

If true, how can I do this?

Actually, I can draw it in JAVA code, but it's too slow and costs too much CPU time. So I want to try drawing it with OpenGL. Is there any other advises? Or maybe OpenGL can't be the right answer?

View 2 Replies View Related

Android : Rotate Bitmap In Opengl?

Oct 10, 2010

I am trying to rotate a bitmap in OpenGL. I have searched around and come up with this. code...

Drawing the bitmaps indicated with the "ids" works fine but no rotation happens. I am no expert at openGL. Is is possible I need to set some sort of mode prior to the rotation?

View 8 Replies View Related

Android : Use OpenGL To Make Bitmap Without GLSurfaceView?

May 2, 2010

I would like to be able to use OpenGL in the Android to render into a bitmap (or any other sort of buffer I can turn into one), without actually displaying a GLSurfaceView.

The purpose is to dynamically create very complex images using OpenGL, and then drawing those images on the canvas of a MapView.

I have tried overlaying a translucent GLSurfaceView over a MapView, my preferred approach, but it has some problems:

1) I have complex menus I need to display from either the MapView or the GLSurfaceView. I have been doing this using a ListView with its own activity. Unfortunately, that activity pushes the MapView down the stack. The result is a bit of flickering when the ListView activity finishes, popping the MapView back to the top. Even worse, if I use the ListView to overlay the GLSurfaceView (giving it the same complex menu capabilities), when it finishes, the GLSurfaceView reappears but the MapView doesn't display.

2)As soon as the GLSurfaceView is created, the MapView stops fetching and rendering tiles. There seems to be no way to know when the MapView is complete, so I have to delay an arbitrary interval before creating the surfaceview.

3) When the GLSurfaceView is present, the MapView's built-in user interface functions are obscured.

Anyone know if there is a way around any of these problems?

View 4 Replies View Related

Android :: Opengl Es Texture Created From Bitmap All White?

Feb 18, 2009

All the textures I create from my resource files are fine, but when I create a texture in the following way... <code> mOverlay = Bitmap.createBitmap((int)mWidth, (int)mHeight, Bitmap.Config.ARGB_4444); mOverlay.eraseColor(0); mOverlayCanvas = new Canvas(mOverlay);

...

Canvas c = mOverlayCanvas; c.drawColor(Color.argb(0, 0, 0, 0)); Paint p = new Paint(); p.setColor(Color.RED); c.drawCircle(160, 240, 10, p);

....................

View 4 Replies View Related

Android : Way To Create Spinner Programmatically From Array

May 6, 2010

I'm all new to Android and I'm trying to create a spinner programmatically and feeding it with data from an array, but Eclipse gives me a warning that I can't handle.

Here's what I got:

This ArrayList holds the elements that should be in the spinner (gets filled from a file later on):

ArrayList<String> spinnerArray = new ArrayList<String>();

This is code ...

Now the second line (ArrayAdapter...) gives me a warning in Eclipse saying "ArrayAdapter is a raw type... References to generic type ArrayAdapter<T> should be parameterized", I have no idea how to fix this (or what that means in the first place :) ).

It's just a warning and the App seems to run alright, but I'd still like to understand what's wrong and fix it.

View 2 Replies View Related

Android :: How To Create An Array Of Objects Which Include Arrays?

Jan 1, 2010

I would like to create a list objects called Product (Listproducts).In the application I first have to create the list List products from XML file and then display the products on the map. One product can be located at several locations.Does anyone know what is the most appropriate way to create the structure (a list or linked list) which is the easiest to iterate through and enables to link the lists? The logic should work the following way:

1. Read each point from the list

2. Check which product belongs to the point

3. Display the product informations on the map

View 5 Replies View Related

Android : Can I Create A List Array With Cursor Data In Droid?

Aug 30, 2009

How can I create a list Array (the list display First Alphabet when scroll) with the cursor data?

View 1 Replies View Related

Android : Want To Create Bitmap From BitmapDrawable?

May 26, 2009

How can i convert a BitmapDrawable into a Bitmap (hopefully it keeps the Alphachannel from the BitmapDrawable)..

View 11 Replies View Related

Android : Create Bitmap From Byte[]?

May 4, 2010

How do I create a Bitmap from a byte[]?

View 2 Replies View Related

Android : Can I Create Bitmap From An Image (.png)?

Aug 18, 2010

I have an image in .png format in "drawable" folder and need to create Bitmap from it, so can use in public void drawBitmap (Bitmap<http://developer.android.com/reference/android/graphics/Bitmap.html>bitmap, float left, float top, Paint <http://developer.android.com/reference/android/graphics/Paint.html>paint)

View 2 Replies View Related

Android : Need To Create A New File ( To Be Sent ) From A Bitmap

Jul 30, 2010

I have a bitmap "picPrev" which I got from my online server. I want to turn it into a file so I can send it. I was exploring this method. code...

View 2 Replies View Related

Android :: Create 1024x1024 Texture In OpenGL

Dec 27, 2009

I'm trying to create a 1024x1024 texture in OpenGL. I'm trying to do this with Bitmap bmp = Bitmap.createBitmap(1024, 1024, Bitmap.Config.ARGB_8888); GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bmp, 0); But I can't actually create a 1024x1024 Bitmap - I get an out of memory exception.

I want to generate the texture, then use texSubImage2D to copy on various smaller bitmaps, but it seems that I need to somehow define that the texture is 1024x1024 before I can do that. Is there a function that lets me define the size/argb settings without just copying in a blank bitmap?

View 6 Replies View Related

Android : Want To Create Complex 3D Drawings In OpenGL ES?

Jun 3, 2010

I'm new to opengl-es and I wonder how people are able to draw these much detailed OpenGL ES graphics, e.g. on Android OS. It's already hard to draw a single squre, because it's composed of triangles due to the reason that OpenGL ES obviously cannot draw anything else than triangles.
I thought about this approach:

Drawing and rendering an object in Blender.
Export it somehow as array of vertices and an array of colors
Copy this array of vertices into the Java code
Run the code

Or are there approaches to solve such problems in a better way? I do not think that people just "draw" their graphics as array of vertices in the code. I'm sure they draw them anywhere else and import it into the code.
If there is such a solution with Blender, I would be pleased to know how this is solved.

View 2 Replies View Related

Android : How Might One Create A Large Bitmap In Droid

Aug 10, 2010

I am trying to build an Android application which can take several photos taken by the camera, and merge them into one giant image. For example, I might take three photos and arrange them in a vertical stack for output as a single image. Ideally, I'd like to be able to keep the images at the original size. Unfortunately, using Bitmap.createBitmap() causes an OutOfMemoryException before even approaching the size of one photo of camera dimensions. Is this possible? Or do I just need to resort to scaling the photos before trying to merge them into a single Bitmap?

View 1 Replies View Related

Create Static Array Of Objects In Java?

Jan 1, 2014

I'm a little new too java programming. Im looking for a means to store groups of static data..so I understand these simple string arrays...

[HIGH]
private static String[] names = new String[] {
"aidanmack",
"johnsmith"
[code]....

But can I not combine that into an array of objects? somthing along the lines of what you would do with json? like...

[HIGH]
private static array[] multi = new array(){
{"name":"AIDANMACK","age":"30"},
{"name":"johnsmith","age":"31"}
}
[/HIGH]

View 1 Replies View Related

Android :: Cannot Create New Map View To Draw To Off Screen Bitmap

Oct 29, 2010

I'm trying to create a MapView in a service (live wallpaper), but have it hidden so that I can render it to a Bitmap, and then map it to a texture to render in opengl. I have a Canvas and a Bitmap, and I intended to call myMap.draw(myCanvas) in order to get it into the correct bitmap so that I could then bind it as a texture.

When I Initialize I do the following:
myMap = new MapView(ctx, APPSTATICS.MAP_API_KEY);
I get an error:
java.lang.RuntimeException: stub at com.google.android.maps.MapView.<init> (Unknown Source)
Why I can't create a new mapview which I can use to draw to a offscreen bitmap?

View 7 Replies View Related

Android :: How To Create Bitmap Thumbnail So Speed Improves?

Nov 12, 2010

I am using MediaStore.Images.Thumbnails.getThumbnail to create bitmap of thumbnail in htc hero , it takes lots of time to execute this. I other device it works faster. Please suggest any alternative to this method to create bitmap thumbnail so speed improves.

View 3 Replies View Related

Android :: Alternatives To Create Scaled Bitmap When Adding 3D

Dec 4, 2009

I have a problem - I am writing an application that displays up to 12 images on screen, and moves them around, plus reads touch events. I am using a sample code I found, and it works great. Now I need adding 3D - meaning emulating the objects moving in the Z axis, too (in/out of screen). To do this, I need to resize the images as they move. To test this, I changed the following line in my onDraw (Panel) code: canvas.drawBitmap(bitmap, coords.getX(), coords.getY(), null); to: Bitmap bmpScaled = Bitmap.createScaledBitmap(bitmap, 112, 112, false); canvas.drawBitmap(bmpScaled, coords.getX(), coords.getY(), null); Which works, BUT - movement on screen, plus response to touch events becomes real Jiggly. Checking the log I see that every call to createScaledBitmap causes garbage collection of around 90mS, which causes the total app to respond jiggly. Tried preparing 20 sized bitmaps beforehand, but since that moves the calls to those createScaledBitmap to the beginning of the app - it takes forever to load. Can you think of any workaround or other way to achieve the scaling effect?

View 3 Replies View Related

Android : Create Bitmap From Droid.graphics.Path?

Oct 5, 2009

I am banging my head against the wall trying to create a Bitmap from a Path object (android.graphics.Path). Is there any way to do this? I've browsed through most of the classes now but can't seem to find any way to do it.

Actually, what I have is a Path that consists of many cubic Bezier curves. It is really expensive to draw with canvas.drawPath(). So I figured that I could perhaps "cache" the Bitmap of this Path by converting the Path to a Bitmap once and then just drawing the Bitmap every time instead of calling canvas.drawPath().

Is there any way to create a Bitmap from this Path?

Or is there a smarter way to draw tha Path multiple times without having to recalculate all of the Beziers? For example, if I created a ShapeDrawable from PathShape from the Path, and just draw the ShapeDrawable objects every time, would that be more efficient than drawing the Path every time?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved