Android :: Storing Bitmap Images For Game Animation
Apr 3, 2009
Just starting a little game project and have a super basic question. what's the best way to store animation images for a game? I looked at the alien bloodbath code and they store multiple frames in a single png file. Is that the preferred way or is there easier/better way to do it? MP4?
View 2 Replies
Aug 17, 2010
I'm working on an app that, upon instillation of certain apps will send a message to them to register with a content provider. It all works fine, the strings are stored, but I can't get the byte[] blob (a bitmap .png file) to convert properly from within onRecieve() in the broadcastreciever.
CODE:.................
I hijack the context so that I can get a hold on the image from the getAppIcon() call (You extend this class which is an abstract class extending BroadcastReceiver) i.e.
CODE:......
But my understanding of the context is limited and I think this is what is causing it to be stored incorrectly.
I've also tried getting the bitmap from the resources when onRecieve() is called and that doesn't work either.
View 1 Replies
View Related
Feb 27, 2009
I am currently trying to store an image into the sqlite database as a blob and retrieve it back.I am not sure if this is the correct approach since i dint find much of sample codes related to inserting images in sqlite. I am able to insert values but when i try retrieving them as byte using decodeByteArray it gives me the following error. DEBUG/skia(13003): xxxxxxxxxxx jpeg error 53 Not a JPEG file: starts with 0x%02x 0x%02x.The image retrieving query works fine as i have checked retrieving an image previously stored as blob in a sample database.I have tried storing and retrieving different image files but i am getting the same error.Could any one tell me as how to solve this problem
View 4 Replies
View Related
Jul 16, 2010
I was working on Android 1.5, but now moved to the latest version. So there is only "drawable" folder in Android 1.5, but now There are 3 different folder for storing images in android project. And as i have found some articles for these 3 folders that
hdpi means High-dpi
mdpi means medium-dpi
ldpi means low-dpi
But still in confusion that what is the exact purpose of these 3 folders and when to use particular folder to store images in that?
View 3 Replies
View Related
Nov 4, 2009
I want store an image using a SQLite database in Android (using an insert statement).Also I need to retrieve the image from the SQLite database and display it on the screen.
View 1 Replies
View Related
Sep 15, 2010
I have an unlockable mode in my game that is only available once the story mode has been completed. This works perfectly if the story mode is completed during a test play through, because upon returning to the main menu the bonus mode is unlocked and selectable. However when I shut down the app and relaunch it, none of the previous state information is retained and it requires you to beat the story mode again to access the bonus mode.
I use the onSaveInstanceState method to create a bundle that stores this information (ie. a boolean whether the mode is unlocked or not), but this information seems to be lost between ending the app, and relaunching it. The onCreate method takes the parameter of a savedInstanceState but yet this seems to be null.
Is there a step that I'm missing out, or doing incorrectly somewhere along the line? On a PC game I would just serialize the state into a text file and look for a special string/symbol upon initialization but I cant do that here so i thought the outState bundle you create in SIS was how you retained information for use upon next launching the app again?
View 2 Replies
View Related
Feb 24, 2010
I have bitmap displayed on the top of the screen when the app is started up. When clicking on the bitmap, the image should move to the bottom of the screen.
I have read the AnimateDrawables from ApiDemos, but the animation is done on a Drawable Object. If it can use on bitmap, it will be great!
Here is my code...
View 5 Replies
View Related
Sep 27, 2010
Am trying to store all images in my server, then i need to show based on requirements, i am able to store and restore bitmap bytes but i cant recreate the bitmap using stored bytes , pls find my code below and suggest me a solution if i doing wrong.
Converting Bitmap to Bytes. Code...
View 13 Replies
View Related
Jul 26, 2010
I want to place an animated marker showing a user's current location in an Overlay over a MapActivity. I need to be able to turn the animation on and off.
I thought this could be accomplished as follows:
CODE:..............
The constructor is invoked from the main MapActivity.onResume() using
locationOverlay = MyLocationOverlay(this)
And the animate/draw is invoked by
CODE:.................
However, the run() method never seems to be invoked.
View 1 Replies
View Related
Aug 31, 2010
ContentResolver cr = getContentResolver(); Uri pic = Uri.parse("content://media/external/images/media/3");
Bitmap bm = Media.getBitmap(cr,pic); The above code is written in onCreate method of my Activity class. It throws the following error:
08-30 12:27:22.352: WARN/System.err(245): java.io.FileNotFoundException: No content provider: [content://media/external/images/media/3]
What could be wrong? The file in question is there because I launched Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI) in another method and got back the Uri of the picked image from the returned intent.
View 1 Replies
View Related
Jul 24, 2010
I am a beginner Android developer and I need to know how to Save and Load images (Bitmaps) from the Android Gallery, But I dont even know where to start! Can someone help me to know where to get started, or even look?
View 1 Replies
View Related
Jul 22, 2010
I'm developing an image editor for Android. When I do some operations with small pictures (600x600 - 1024x768), the program work well. But when I do some operations with big pictures, I always obtain an OutOfMemory Error. I read read many post trying to have the image in memory. Also I looked at the Android's Gallery, trying to simulate the effect of loading the image with lower quality and get the complete quality after a while. But I doesn't get to work with large images.
I thought of using the parameter inSampleSize but I raised the problem of having to perform operations on the image and save it with the original size, so it no longer serves me. The only thing I've done is use the parameter inJustDecodeBounds and display an error to the user if the image exceeds the available memory.
Is there any possibility of working with large images with no memory problems? I need urgent help.
View 19 Replies
View Related
Oct 13, 2011
i want to create a basic animation with a sprite sheet. there is only one row with about 2 pics (that's the first animation).
View 3 Replies
View Related
Jan 13, 2010
I had a question related to whether or not (and how) I should store images loaded from the web. Let's say I am calling a web service from my Android app. In this web service I get a URL for an image on the web. I download and show this image on the left side of a list item in a ListView. My question is, what method should I use for possibly storing the image? Should I.Save it to the SDCard, checking if it exists when the ListView is created (on subsequent requests) and re-downloading as necessary (while updating the image occasionally, in case it changes).Store it in the cache using Context.getCacheDir(), but possibly being forced to re-download it more often since I cannot rely on the image staying in the cache.
Always download it and never store the image.
The image files themselves are fairly small, but I expect some users could have dozens of these small images downloaded/stored. Which would work best, and/or what is the preferred method? As a side question, should I load all of the images in my ListView first (and possibly lock the UI for some time) or load them asynchronously but show a placeholder graphic in the meantime (which might be a bit more "ugly")?
View 4 Replies
View Related
Dec 16, 2009
I try to write an simple animation by using a handler.However whatever I try it does not function asynch which causes only the last image in the sequence being displayed.
CODE:...........
However it seems that all painting is done after the handler is completely done, meaning that the second image is shown and not the first.
I also tried the message handler implementation from the Snake sample but also here not with the expected result.
Can anyone give me an idea to show an image for a short definable period and switch back to the original image?
View 2 Replies
View Related
Aug 17, 2010
I have been working on Android for a few months. Now i want to jump to gaming in Android. So are there any resources, ebooks, or tutorial where I can study game development be it 2D or 3D.
View 1 Replies
View Related
Apr 19, 2010
I want to star an animation with three images on an app widget, and It should be pause, resume and stop.
View 5 Replies
View Related
Nov 2, 2010
I'm developing a small Android database app.Associated with the records in the database is a number of images (the image resolution will probably same as the screen on the device), there could be up to 20 images per record.Where would be the best place to store the images.I'm thinking either in the database itself or on the SD card.I'm pretty new to Android and as yet not really sure what I'm doing.
View 2 Replies
View Related
Jan 6, 2010
I developed a game with the g1 in my mind. Now I want to support large screen sizes but I don't want to add in the apk different images for different screen sizes because now the apk is 3mb and when installed thought market it became 6mb (due to protection on). If I have to double the images to support new screens, the apk would be too heavy (about 13mb, I think) so I'm wondering to know if scaling images at runtime by myself (without compatibility mode) maybe the best way for supporting larger screens. Compatibility mode does a great work in scaling images but it slows down drastically the frame rate (I think because the scale operation is made every time an image is used/moved and not only once on the load of the image itself).
View 7 Replies
View Related
Feb 16, 2009
I wanted to know that how to use sound in animation,Actually i wanted to create a online bidding game and i want to use sounds in that animation.
Can u let me know how to do this.
View 2 Replies
View Related
Feb 4, 2010
I'm trying to develop a 2D game to android using opengl. I know how to print images on the screen and animate them. But in my game I have a map and a want to zoom in and out and scroll the map. But I can't figure out the best way of doing it.
View 2 Replies
View Related
Feb 18, 2010
I've created an application that show around 250 images in ImageView. Images are loaded one after another, 15-30 images per second. Basically the whole thing gives an illusion of a rotating 3D object, at least it should.
The problem is next, app hangs when loading certain images(i.e. I see a few seconds of fluid animation and then animation hangs, jump 10-15 frames(images) ahead and continues. It always happens at the same places in animation cycle.
I though that Android might not have enough resources to handle something like this, so I've resized images to half their size, but it did't help. I've tried buffering images but that did't help either(actually, maybe a little, I think that animation looks a little bit smoother).
And now the weirdest thing. I use the touch screen to allow users to "rotate" the 3D object on those images, and while rotating I again experience those hangs at exactly the same places as with the animation.
All images are in .png format and their size vary from 15kB to 40kB.
I use the following code for the animation:
CODE:.....................
View 1 Replies
View Related
Oct 3, 2010
I am writing a game for Android and I think I have a fatal flaw in my architecture and/or code. The architecture is basically two threads, one that just continuously draws the screen and the other than controls the movement of the drawables on the screen based on the user's touch screen input. In the latter thread, I'm basically doing manual animation (insert correct term here), meaning I move the drawables on the screen via methods that change the Drawables Rect as the game progresses. The "no-no" I believe I'm doing is inserting delays into these methods, so that it "appears like an actual animation." This all works fine and dandy because I have no reason to process any user input during these animations, but it's really bugging me that I'm designing a flaw into a lot of hard work with my game. I'm sure many of you can relate to this in terms of code design.
View 3 Replies
View Related
Nov 17, 2010
I'm fading out an imageview with alpha animation. I'd like the image to stay transparent after the animation. Tried with different combinations of fillAfter and fillEnabled, no luck. How can this be achieved?
View 1 Replies
View Related
Jul 21, 2010
I have a very large image and I only want to display a section the size of the display (no scaling), and the section should just be the center of the image. Because the image is very large I cannot read the entire image into memory and then crop it. This is what I have so far but it will give OutOfMemory for large images. Also I don't think inSampleSize applies because I want to crop the image, not lower the resolution.
Uri data = getIntent().getData();
Input Stream is = getContentResolver().openInputStream(data);
Bitmap bitmap = BitmapFactory.decodeStream(is, null, null);
Any help would be great?
View 3 Replies
View Related
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
Oct 8, 2009
I have two questions actually:
Is it better to draw an image on a bitmap or create a bitmap as resource and then draw it over a bitmap? Performance wise... which one is better?
If I want to draw something transparent over a bitmap, how would I go about doing it?
If I want to overlay one transparent bitmap over another, how would I do it?
View 1 Replies
View Related
Mar 22, 2009
My goal is the draw a bitmap onto another bitmap but rotated 90 degress. whats the most efficient way to do that. My current method is as follows which is horribly bad because it creates a new bitmap every time.
CODE:.....................
View 4 Replies
View Related
Aug 30, 2010
I have a strange issue - from time to time the animation that should fade out my control (ImageButton) does not kick in immediately. I am using the fadeout animation to hide it and then in myListener on its end (onAnimationEnd) I put new resource as the image on the button.
Somewhere in my app code:
Animation a = AnimationUtils.loadAnimation(this,R.anim.fadeout); a.setAnimationListener(new myListener(location)); buttons[location].setAnimation(a); a.startNow(); // regardless if its start() or startnNow() it will work in most of the cases but not 100% reliable I actually can see in debug Log when its late, happens after few more clicks
Then in myListener.onAnimationEnd(Animation a):buttons[location].setImageResource(R.drawable.standard_button);
Seems there is a rule that the every 4th or 5th animation does not start ...
View 1 Replies
View Related
Jun 22, 2010
I want to draw a shape(many circles particularly) into a Specific Bitmap. I have never used canvas / 2D graphs etc. As i see it i create a Drawable put the bitmap in it then "canvas-it" to the shapes i want etc.
View 1 Replies
View Related