Search Results

Search found 6 results on 1 pages for 'user279112'.

Page 1/1 | 1 

  • How did the Lunar Lander example make the image backgrounds transparent?

    - by user279112
    Hello. I'm trying to make a GUI program with the Android SDK, using their Lunar Lander example as a significant self-teaching tool in the process. I've noticed their sprites' images' backgrounds, which were at least usually pure white, did not show up in their program. I want to ask how they did that, since their site doesn't explain simple things very well. I've managed to pull that off before on another GUI SDK, wherein all I had to do was to call a function and pass it a few floats to define a certain color, and until my code told it to do otherwise, that function would make sure that that particular color in my sprites' images was totally transparent. However I've wrestled with the Lunar Lander example and getting my own program to show some custom graphics for a week or two now, and I haven't noticed any such function call in the Lunar Lander example. I tried to look for it, but I did not find anything. I've tried to Google some tutorial or other reference material, but what I've found so far is just straying off into unrelated areas and totally dodging this EXTREMELY important lesson on the SDK's basics. Any ideas? Thanks!

    Read the article

  • How do you handle key down events on Android? I am having issues making it work.

    - by user279112
    For an Android program, I am having trouble handling key down and key up events, and the problem I am having with them can almost certainly be generalized to any sort of user input event. I am using Lunar Lander as one of my main learning devices as I make my first meaningful program, and I noticed that it was using onKeyDown as an overridden method to receive key down events, and it would call one of their more original methods doKeyDown. But when I tried to implement a very small version of my own onKeyDown overide and the actual handler that it calls, it didn't work. I would probably copy and paste my implementations of those two methods, but that doesn't seem to be the problem. You see, I ran the debugger and noticed that they were not getting called - at all. The same goes for my implementations of onKeyUp and the handler that it calls. Something is a little weird here, and when I tried to look at the Android documentation for it, that didn't help at all. I thought that if you had an overide for onKeyDown, then when a key was pressed during execution of the program, onKeyDown would be called as soon as reasonably possible. End of story. But apparently there's something more to it. Apparently you have to do something else somewhere - possibly in the XML when defining the layout or something - to make it work. But I do not know what, and I could not find what in their documentation. What's the secret to this? Thanks!

    Read the article

  • What are the basics of dealing with user input events in Android?

    - by user279112
    Hello. I thought I had understood this question, but something is quite wrong here. When the user (me, so far) tries to press keys, nothing really happens, and I am having a lot of trouble understanding what it is that I've missed. Consider this before I present some code to help clarify my problem: I am using Android's Lunar Lander example to make my first "real" Android program. In that example, of course, there exist a class LunarView, and class nested therein LunarThread. In my code the equivalents of these classes are Graphics and GraphicsThread, respectively. Also I can make sprite animations in 2D just fine on Android. I have a Player class, and let's say GraphicsThread has a Player member referred to as "player". This class has four coordinates - x1, y1, x2, and y2 - and they define a rectangle in which the sprite is to be drawn. I've worked it out so that I can handle that perfectly. Whenever the doDraw(Canvas canvas) method is invoked, it'll just look at the values of those coordinates and draw the sprite accordingly. Now let's say - and this isn't really what I'm trying to do with the program - I'm trying to make the program where all it does is display the Player sprite at one location of the screen UNTIL the FIRST time the user presses the Dpad's left button. Then the location will be changed to another set position on the screen, and the sprite will be drawn at that position for the rest of the program invariably. Also note that the GraphicsThread member in Graphics is called "thread", and that the SurfaceHolder member in GraphicsThread is called "mSurfaceHolder". So consider this method in class Graphics: @Override public boolean onKeyDown(int keyCode, KeyEvent msg) { return thread.keyDownHandler(keyCode, msg); } Also please consider this method in class GraphicsThread: boolean keyDownHandler(int keyCode, KeyEvent msg) { synchronized (mSurfaceHolder) { if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) { player.x1 = 100; player.y1 = 100; player.x2 = 120; player.y2 = 150; } } return true; } Now then assuming that player's coordinates start off as (200, 200, 220, 250), why won't he do anything different when I press Dpad: Left? Thanks!

    Read the article

  • How do you fix issues with the debugger for the Android plug-in for Eclipse not attaching?

    - by user279112
    I have been trying to program something for the Android mobile phone, using Eclipse and the Android plug-in for that IDE, and my debugger used to attach just fine. But then it has suddenly started having consistent issues attaching. I just get that message about how the process is waiting for the debugger attach, and then it just won't. What determines whether the attachment glitches so seems to have something to do with what the code is that I'm trying to debug, as it seems to be drastically more of an issue with some versions of my code than with others (on the same app). How do I fix this? Now before you answer, please understand that I have researched this issue already. I have found a couple of solutions that have worked with other people, but which do not work for me. One of which is setting the debuggable property in the main manifest file as true, and the other is going into Dev Tools and into some settings menu, and from there selecting the process and essentially saying to the fake phone, "Debug this process". Neither has really worked. Any other ideas? And just in case...I've run into one blasted technical issue like this after another trying to program for that stupid phone. And I'm not the only one who's having these issues; when I go online to research these issues, it is always very easy for me to find many people who have the same issues, and who are having to use the shottiest, sloppiest, most "ghetto" solutions to work around these issues. I know that many people have created good applications for that phone, but I don't see how I'm supposed to do that when the SDK and the plug-in just don't work half the time. Does anybody know how I may put all this trash behind me, once and for all? Thanks for your answers to either question!

    Read the article

  • How do I keep from running out of memory on graphics for an Android app?

    - by user279112
    I've been working on an Android app in Eclipse, and so far, my program hasn't really grown past midget size. However I've already run into an issue with an Out of Memory error. You see, I've been using graphics comprised solely of bitmaps and PNGs in this program, and recently, when I tried to add a little bit more functionality to the program (mainly including a few more bitmaps and causing an extra sprite to be created), it started crashing in the graphics thread's constructor - sprite's constructor. When I tracked the problem down, it turned out to be an Out of Memory error that is seemingly caused by adding too many picture files to the program and creating Drawables out of them. This would be a problem, as I really don't have that many picture resources worked into that program...maybe 20 or so. I haven't even started to include sound yet. These images aren't all that fancy. My questions are this: 1) Are programs for the Android phone really that limited on how much memory they can employ, or is it probably something other than the 20-30 resource pictures causing that error? 2) If the memory for Android apps is so awful it can't even handle 20-30 picture resources being loaded into Drawables that exist at the same time, then how in the world are you supposed to make decent graphics and sound for that thing? Thanks.

    Read the article

  • How big can I make an Android application's canvas in terms of pixels?

    - by user279112
    I've determined an estimate of the size of my Android emulator's screen in pixels, although I think its resolution can be changed to other numbers. Quite frankly though that doesn't eliminate the general problem of not knowing how many pixels on each axis I have to work with on my Android applications in general. The main problem I'm trying to solve is this: How do I make sure I don't use a faulty resolution on Android applications if I want to keep things' sizes constant (so that if the application screen shrinks, for instances, objects will still show up just as big - there just won't be as many of them being shown) if I wish to do this with a single universal resolution for each program? Failing that, how do I make sure everything's alright if I try to do everything the same way with maybe a few different pre-set resolutions? Mainly it seems like a relevant question that must be answered before I can come across a complete answer for the general problem is how big can I always make my application in pixels, NOT regarding if and when a user resizes the application's screen to something smaller than the maximum size permitted by the phone and its operating system. I really want to try to keep this simple. If I were doing this for a modern desktop, for instance, I know that if I design the application with a 800x600 canvas, the user can still shrink the application to the point they're not doing themselves any favors, but at least I can basically count on it working right and not being too big for the monitor or something. Is there such a magic resolution for Android, assuming that I'm designing for API levels 3+ (Android 1.5+)? Thanks

    Read the article

1