[android-beginners] Adhoc net connection over Wi-Fi
Hi, I am trying to browse the net over Wi-Fi on my android developer phone. I have created an Ad-hoc connection on my Mac and want to connect the phone to this using Wi-Fi. The setup is working perfectly when I connect my iPod Touch to the Mac. However in the case of the ADP, I am unable to browse the net. It keeps giving the message There was a network error. I am able to connect the ADP to the network and it shows connected with an excellent signal strength. It even acquires an IP automatically from the Mac. I have tried with both the Open as well as WEP encrypted network. However I am unable to browse or even access my Gmail account. Any suggestions would be much appreciated. Thanks, -- You received this message because you are subscribed to the Google Groups Android Beginners group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en
[android-beginners] Re: from iPhone to android
although i havent used Quartz much on iphone, i think you'll get most of its functionality in the Canvas class of the android. this Class contains many methods to draw lines, circles, bitmaps, text etc. a related class is the Paint Class that allows you to specify the style of drawing - i.e. colour, stroke etc.it is not necessary to get a current context prior to drawing in Android. for a game you'll probably need to extend the View Class and then override its onDraw method. i'd suggest you browse through the Class Index for Android and go over the documentation for these classes. the Class Index on Android is very well compiled and its a one-place reference guide for the entire platform, unlike the iphone where you have different documents for different frameworks. from a graphics point of view, the following are some crude analogies between the two platforms: UIViewController on iphone corresponds to (Activity + ViewGroup) on Android UIView on iphone corresponds to View on Android the drawRect method of UIView corresponds to onDraw method of the View class on Android setNeedsDisplay call on UIView is the same as invalidate() call on a View on Android on Android, the Views and Subviews dont automatically redraw (i.e. invalidate) themselves unlike their counterparts on iphone. for eg, suppose you have a game character that you display using a UIImageView on iphone. if you change the position of this object then it automatically updates the same on the screen. however on Android you will have to send an invalidate call to the View that contains this game character. unfortunately designing a screen and UI on android is nowhere as convenient as the drag and drop in Interface Builder. you'll have to specify screen layouts in XML (although it can be done in JAVA code too) using the built in XML editors on eclipse. conceptually its exactly the same as creating the xib files on IB ... the difference is that you'll have to do quite a bit of typing instead of drag and drop. hope that helps. On Sep 6, 9:51 am, Hulacir hula...@gmail.com wrote: Hi, I have two Apps now in iPhone AppStore and I am thinking about developing the Android version too. I would like to get some feedback from those who have already done this. I am more concerned about the 2D graphics side. On iPhone, it is Quartz. Do we have CGContext and something similar on Android? thanks, hl --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] GestureListener events
i'm using the GestureDetector and GestureListener in a program. i want to have separate actions for the onFling and onScroll events. for a scroll event there is no problem - only the onScroll event is called. however for a fling event BOTH the onFling and onScroll events are being called. i tried returning true in the onFling method to prevent further propagation of the event but that didnt help. following is the code excerpt from the onTouchEvent and the related gesture events: private static boolean fling, scroll; //two boolean values to detect whether the performed action is a fling or scroll private GestureDetector scanner; //this is the gesture detector public boolean onTouchEvent(MotionEvent me){ fling = false; scroll = false; scanner.onTouchEvent(me); if (fling) { scroll = false; return true; } else if (scroll){ return true; } return super.onTouchEvent(me); } public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { fling = true; return false; //changing this to return true at this point makes no difference } public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { scroll = true; return false; } what i tried in the onTouchEvent method above is to put a kind of a lock so that if a fling is detected then the appropriate action is taken and the event is not propagated further. however despite trying every combination of returning true / false in each of the above methods, i am unable to separate out the fling event from the scroll event. as i said - there is no problem in the conventional scroll - in this case only the action for scroll is being performed. for the gesture events, is there any particular sequence in which the event is propagated? i.e. does it first go to the onClick, then the onFling, then the onScroll ... etc? any inputs will be greatly appreciated --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Is the emulator good enough for production?
a few more thoughts in favour of actual on-device testing rather than just emulators: 1) what happens to ur game when it is interrupted by an incoming call / SMS? 2) the touch events in the emulator are triggered by mouse-clicks. however on the device the user will use his fingers ... finger touches have far lower precision than mouse-clicks 3) the performance of ur code could be much slower on the device than on the emulator. u'll need to optimize accordingly 4) the emulator has a (physical dimensions) larger screen. this does not give u a true picture of what the graphics appear on a real device. i'd say this is very important especially for a game On Jul 1, 5:51 pm, Carl carl...@gmail.com wrote: I have written a game for Android and have tested it on the emulator - everything seems to be perfect. It is a simple game with few graphics and a few touch-based commands. I'd like to release it on the market (paid). I have not yet tested it on any devices though, as I am waiting for the HTC Hero to be released so I can buy a device. Should I wait for the release or is the emulator reliable enough? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Android Emulator Orientation on Macbook
use Control + F11 On Jun 21, 2:51 am, ed ed.atw...@gmail.com wrote: I know I've seen this question asked, but none of the answers seem to apply. I have a Macbook (not a MacbooPro) without numeric keypad, and I'm perplexed as to how to change the orientation of the emulator when it starts from Eclipse. The key combinations in the SDK docs do not seem to apply to this hardware. Any help is appreciated. Ed --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Basic Layout
its hard to figure out without looking at your XML content. my guess is that you are using the fill_parent value for the layout_width of your linear layouts and the ImageView. replace this by wrap_content or alternatively specify the exact width in pixels that you want each of the 3 linear layouts to be. you will also have to use the same value on the ImageView. On Jun 23, 5:13 am, Carl carl...@gmail.com wrote: Why has it got to be s difficult? For a week now I’ve been reading and playing around with code and have still not found the answer I want a simple 3 column layout, with images going from bottom to top in each. Whenever I put 3 LinearLayouts next to each other in the Activity, the first one takes up all the space. That is if I add an ImageView to it in the XML. If I don’t then all none of the Layouts appear. Very frustrated and about to quit Android altogether. Please help! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: how to create apk file in android ,like in j2me we create jar and jad files
assuming ur using eclipse with ADT, simply right-click on the project in the left panel, choose Android Tools = Export unsigned Application Package this will create the (unsigned) apk at the destination you specify. before loading this apk, it must be signed with your private key. you can consult the documentation in the Android Developer Guide under the section Publishing your Application for details on how to do this. On Jun 15, 9:50 am, janardhan vuruvakilina...@gmail.com wrote: hi, i am new to android . i done some sample applications. how to create apk files for that one. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: how to create apk file in android ,like in j2me we create jar and jad files
oops ... instead of section on Publishing your Application, read Signing your Applications On Jun 15, 3:32 pm, ayush ayushv2...@gmail.com wrote: assuming ur using eclipse with ADT, simply right-click on the project in the left panel, choose Android Tools = Export unsigned Application Package this will create the (unsigned) apk at the destination you specify. before loading this apk, it must be signed with your private key. you can consult the documentation in the Android Developer Guide under the section Publishing your Application for details on how to do this. On Jun 15, 9:50 am, janardhan vuruvakilina...@gmail.com wrote: hi, i am new to android . i done some sample applications. how to create apk files for that one. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] compatibility of an app across android versions
if an application is developed entirely on SDK 1.1, would it run (with no modifications) on a device with 1.5 installed? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Practical questions
hi, i've had a J2ME background and switched over to android a few months ago since nokia placed their (in)famous restrictions of Java Verified Certification for J2ME apps on the Ovi store. some thoughts on ur queries - 1. Looking at the documentation for Android it seems to me that the learning curve for working with Android is large. compared to J2ME, android has loads more built in classes and libraries. however the JAVA syntax, concepts of inheritance etc remain the same. the learning curve is not steep ... its just that getting good learning material for newcomers takes some time. what u need to pick up first is the basic structure of an android applications - activities, intents etc. once u get the hang of this u'll see that the language elements will take no time to master. a BIG difference - in android u'll have to design for touchscreen devices. its not enough to simply implement the appropriate event handler. designing the application to ensure a convenient UI is crucial. 2. Looking at the available phones they are all about $500 without a contract. We're in a Recession and $500 is a lot of money. Compare that to my 3-inch touch screen Sciphone i68 which was $100 and has MIDP support. fair enough ... but another way to look at it is that android is an upcoming platform. most manufacturers, with the exception of Nokia, are on board and will be launching devices in the coming months. i'm sure u can research a bit and get the sales of the G1 last year as well as the projected sales for coming years. it was enough to convince me that its worth the effort :) also, while the iphone is much cheaper than the $500 tag (thanks to operator bundling) i dont think u can really call it inexpensive. the bottom line IMHO is that a there is a market for a good product price notwithstanding. ur free to form ur own opinion on this. 3. I don't do contracts. I have heard that Android phones are hobbled by the requirement that I'd have to have a contract. I use prepaid exclusively to keep my phone bills down. 4. No contract means no data plan. are u concerned about this aspect as a user or a developer? if its the latter then i dont see why it should be a consideration for u. i dont have exact figures, but i do know that paid downloads from the android market are steadily increasing. as a developer i wouldnt be too concerned about the data plans of my customers apart from the fact that i should keep the size of my application (for download) down to a minimum and avoid unnecessary communication between the device and server. if ur concerned about being restricted to a particular operator on the G1, then u can always purchase the dev phone and choose ur own service provider and tariff plan. 5. I can get a Windows Mobile phone for $260, called the CECT M88+. It will run native apps and J2ME. That's half the cost of an Android phone. ok ... now i'm really confused - are u evaluating android as prospects for a developer or as an end user? u ask about the learning curve and documentation etc but then ur worried about the cost factor of the phone. as a developer J2ME doesnt give u even a fraction of the control and access to APIs that android does. agreed, there are thousands more J2ME apps floating around currently ... but it'll all change in a year or two in favour of other platforms. if ur looking at this whole thing from a customer point of view, then i'm sorry i cant help u much. maybe u should post ur query on customer feedback forums where u'll get a better perspective. 6. Regular consumers know we're in a recession. They are going to avoid expensive phones and long contracts more now than ever. Will $500 luxury Android phones take hold? I'm skeptical. i shall refrain from making my views on this weird statement here on a public forum. in case ur interested then drop a private mail to me and we can dicuss it then. 7. I am not someone who is easily impressed by Google. There is no wow factor for me in using Android. I'm entirely pragmatic. take ur call. i can only give u a developer's perspective on android vs J2ME. for ur considerations about the cost vs benefit of purchasing an android phone i can only refer u to hundreds of customer disucssion boards on this topic. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Creating semi-transparent list items - possible?
if you want a traditional dialog-box look, then another option would be to implement the built in Dialog Theme on your Activity containing the ListView. also, you can override the standard Dialog Theme and make changes to the background colour, fonts etc. theres a short-and-sweet example on how to do this in the Android Documentation under the section on User Interfaces = Applying Styles and Themes. apart from the Dialog Theme you also have a Translucent Theme. however, based on discussion forums, it seems that the Translucent Theme cant be overridden and customized. On Jun 9, 12:31 am, mastix mc masti...@googlemail.com wrote: Hi Mark, I haven't tried it yet, but I guess I can say that you're my hero! :) thank you very much! Thanks, Sascha On 8 Jun., 20:19, Mark Murphy mmur...@commonsware.com wrote: mastix mc wrote: thanks for that hint. :) Well, you only asked if it was possible, not how to actually *do* it... ;-) Do you have a demo/example/documentation that shows me what I have to do? 1. Create a layout for your rows. Make sure your containers (LinearLayout, etc.) have android:background set with an appropriate transparency (e.g., #80FF is red with 50% transparency). 2. Specify that layout when you create your adapter. This could be as simply as providing the layout ID in the adapter constructor, all the way to implementing getView() (or newView()/bindView() for CursorAdapter), depending on what you want to do with your rows. For the getView() scenario, visit: http://wiki.andmob.org/samplecode where you will find links to the half-dozen or so blog posts I made under the Fancy ListViews series. -- Mark Murphy (a Commons Guy)http://commonsware.com|http://twitter.com/commonsguy Android App Developer Books:http://commonsware.com/books.html --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Hello, Android the book
i've purchased both the books - Hello Android and Busy Coders Guide and after two months (and 4 android applications developed) here are my thoughts - the Busy Coders Guide has been the single most useful resource during my brief stint with android. for a newcomer, it does a great job of explaining the concepts in a concise step-by-step manner. even though i have a J2ME background, the concept of using XML to define elements, layouts etc was new to me. it was only after reading this book that i became comfortable with this aspect and understood the huge benefits of the XML approach. positives of this book - 1) crisp, clear and systematic explanation of all concepts 2) covers almost all aspects of android ... i.e. pretty much a one- stop solution and reference. its second only to the actual Android Documentation 3) written in a style that even newbies can follow - very very important aspect INMO negatives (if at all u consider them as negatives): does not deal much with the topic of improving the look and graphics of ur application. theres hardly any discussion on using elements such as Custom Views, Gradients, AnimationDrawables etc ... though i guess these things matter only to budding game programmers like me. overall still a great book to have. Hello Android seemed an excellent buy when i first read the reviews. as i said, i'm focussed more on game development and it seemed a great book considering that the author builds a Sudoku game from scratch. positives of this book - 1) covers all designing concepts and techniques for game design on android 2) starts off the project (i.e. Sudoku) from scratch and takes the reader through the entire game development cycle negatives - the author tries to cover too much in too short a time. so even though at the end of 4 chapters u have a pretty decent model of a game running, u dont really feel as though u have quite grasped the foundations of the core concepts. game design can broadly be classified into three parts - a) the basic skeleton - i.e. a main menu with buttons for New Game, Help, High Scores, Exit etc. each of these buttons link to a new screen as required b) the core game logic - i.e. the coding part ... variables, arrays, methods etc c) the visual appeal and experience - i.e. how to improve this aspect of ur game in my opinion, the book should ideally be divided into two parts - the first to deal with the basic steps of setting up a skeleton, linking the buttons to new screens, displaying game content on those screens and navigation between screens. once the reader is familiar with this process, the second part could dwell deeper into the finer aspects like preferences, different menu structures, saving game states, 3D Graphics etc. all in all, there still arent too many decent books available for android given its infancy ... but both the above books have been a real help in their own ways. hopefully this review will help new developers searching for learning resources. ~cheers On Jun 5, 9:07 pm, Musashi Baka musashib...@gmail.com wrote: Hello Android is indeed excellent. My personal favorite is The busy coders guide to Android development. I purchased the e-book (pdf) which came with two other books (The advanced guide, and the tutorial) for free. I primarily purchased it because of the 1 year update guarantee, and with the sdk constantly evolving I would hate to buy a book that didn't update its examples. Just my 2cents. On Jun 5, 11:51 am, Steve steveoliv...@gmail.com wrote: I'll second that! And it packs a lot of very good material in only 200 pages, so a great way to get an intro to Android dev in a short time. On Jun 4, 4:43 pm, grakhul grak...@gmail.com wrote: So I went into Borders and bought the book in the subject line. Just my way of keeping open source alive by supporting others. The book is great for a novice with none to limited experience in Java and Android. I would recommend it to any novice or new user interested in Android. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: very very urgent need
there is an excellent example of how to read and write to a txt file on android in the following book - The Busy Coder's Guide to Android Development by Mark Murphy. it covers all aspects of this topic and is very easy to understand. it'll also serve as a good reference for other aspects of android. On May 27, 12:02 pm, abdelkarim bezi beziabdelkar...@gmail.com wrote: hi Aakash Patel thank you i'd like an example explaining how to access file and read data from it.(all th procedure) thank you. 2009/5/27 Aakash Patel aakashbpa...@gmail.com How is your application accessing an external resource on the computer like that? That is not possible. On May 26, 4:02 pm, abdelkarim bezi beziabdelkar...@gmail.com wrote: hi everybody i develop an android application which need to access video file (the path is c:\sequence.mp4) and play it. my problem is that where i launch the emulator nothing is happened and nothing is played. i would like a detailed example which explains how to play a video file (in C:\ or another lector) . thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] MotionEvent coordinates
is it possible to get information regarding a touch event in terms of a Rect or a Region? i.e. when a user presses the screen, then the finger is actually touching a small region at the point of contact and not just one single point. so is there any way to get this region? also, with regard to the above, out of all the points of contact between the finger and the screen, which points are returned by MotionEvent.getX() and MotionEvent.getY()? ~ayush --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: MotionEvent coordinates
does this mean that the getX() and getY() returns the center point of the area touched by the finger? On May 26, 4:22 pm, Sean Hodges seanhodge...@googlemail.com wrote: I haven't tried this before, but I'd imagine you could construct a region positioned at getX()/getY() with a circumcircle radius based on the output of getSize(). With this approach, you will have to define a relative size for the fingerprint. This may not be useful if you are looking for high precision when using a pointer on the touch screen, but an estimate should be satisfactory for a fingerprint. On Tue, May 26, 2009 at 12:02 PM, ayush ayushv2...@gmail.com wrote: is it possible to get information regarding a touch event in terms of a Rect or a Region? i.e. when a user presses the screen, then the finger is actually touching a small region at the point of contact and not just one single point. so is there any way to get this region? also, with regard to the above, out of all the points of contact between the finger and the screen, which points are returned by MotionEvent.getX() and MotionEvent.getY()? ~ayush- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] handling long touch / click in android
i'm using a Custom View in my Activity. can someone give me an idea how to register the long i.e. sustained clicks on this View? i tried the following approach (which didnt work) - the Custom View implements View.OnLongClickListener and implements the onLongClick(View v) method. i also registered the View to handle long clicks using setOnLongClickListener(this). further i called setClickable(true) on the View as well. however the onLongClick is not being called at all. i'm also using a onTouchEvent handler in the view to handle other touch events. i made sure that this handler returns false so as to allow the event to propogate to other listeners. but the long click is still not being called. is there any other way that i can capture an extended click or touch event? the basic objective is something like this - a) the Custom View is the game screen for a board game b) the user touches a piece to move (this is captured by onTouchEvent) c) the user touches the destination square on the board (again captured by onTouchEvent) d) if the user keeps the destination square pressed for around 1 second (i.e. long click) then move the piece the first three points are working just fine with the onTouchEvent. i tried to propogate the fourth event to onLongClick but it doesnt work. ~ayush --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] storing values of an array
i'm designing a simple board game, where the positions and states of pieces are stored in two separate (single dimension) int arrays. i want to give the user the option to save the game and reload the same at a future time. is there anyway that these two arrays can be stored on the device and accessed later? the option of using SQL seemed a little to extensive since the data is just a simple array. ~ayush --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Sprite imaging for 2D game programming
there is no Sprite class available like the one in J2ME. like nicholas suggests - u might want to write your own custom sprite class with the same functionality. i managed to avoid it on my current project, but i guess sooner or later i'll have to write my own game API. here is what i have in mind: 1) the basic Sprite class will extend the BitmapDrawable class in the android.graphics.drawables package 2) the new extended class will have a Rect or a RectF member variable to keep track of its position on screen. The Rect and RectF classes already have useful methods that can be used for detecting collisions 3) the BitmapDrawable class has an existing setBounds() method which contains the actual position to draw the screen the methods for translating / scaling a bitmap within its bounds are not very useful especially when you have a number of frames in your sprite. perhaps u'll need to have an array of bitmaps where each bitmap represents one frame in the animation. again - this will be specific to the game at hand. actually, ALL of the above tasks, including the animation functionality can be implemented using the AnimationDrawable class that is part of the same graphics package as BitmapDrawable. however, despite many attempts i was unable to get it to work in my program. the animation never moved beyond the first frame. apparently other people have faced the same problem ... but i am yet to receive a response to my query posted a few weeks ago. after extensive googling on the subject i came across some complicated solutions, but i never got round to implementing them coz i really didnt need animation in my current project. i managed to create a workaround using static images instead. i'd suggest u try AnimationDrawable once ... if it works then it will solve all your problems. ~ayush. On May 17, 8:31 pm, Nicholas Radford nikradf...@googlemail.com wrote: Take a look at http://developer.android.com/reference/android/graphics/Canvas.html#d..., android.graphics.Rect, android.graphics.RectF, android.graphics.Paint)http://developer.android.com/reference/android/graphics/Canvas.html drawBitmap calls, (if your using the Android graphics and not the OpenGl graphics libs) You'll see this one in particular drawBitmaphttp://developer.android.com/reference/android/graphics/Canvas.html#d..., android.graphics.Rect, android.graphics.RectF, android.graphics.Paint)( Bitmap http://developer.android.com/reference/android/graphics/Bitmap.html bitmap, Recthttp://developer.android.com/reference/android/graphics/Rect.html src, RectFhttp://developer.android.com/reference/android/graphics/RectF.html dst, Painthttp://developer.android.com/reference/android/graphics/Paint.html paint)Draw the specified bitmap, scaling/translating automatically to fill the destination rectangle. Where Bitmap is your Sprite sheet, src is a rectangle on your sprite sheet (just the section you want to draw) and dst is a destination rectangle on the canvas (where you want to draw it), and paint is your paint object. I'd give example code, but I've not actually written anything for android yet, so my example code would not be the best to learn from. Hopefully though, that function will show you the way. Nik 2009/5/17 G. Murat Taşbaşı gmt...@gmail.com Hi guys, For a 2D game programming, I'm trying to learn about loading an image file for all states of a game character (simply a walking soldier lets say) and simply animate it. I think this classic method is called as sprite imaging that you load whole image of all states of the character that you want to animate. Is there anyone that can provide some sample code about this or at least can you tell me which classes to use, how to refer some 'part of' whole image file and animate it etc. Your help is much appreciated. Thanks a lot. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Create a Button on a Canvas
i had tried a similar approach but it managed to get it to work. in fact even defining the button in XML didnt work. i had put up a message in this regard but got no response :( the workaround was something like this - in the activity being displayed, define the View (which has the canvas) and the button separately. then use a ViewGroup container (i used a RelativeLayout) and add the View and the Button as child views to this Container. finally you use setContetView(myLayoutContainer) to display it all. u can use the LayoutParams to position the button anywhere within the container. its a simple matter to get a handle to the button anywhere in your code so as to register the click events. from what i gather, if you need to display two or more views (i.e. ur View with the canvas and the Button) then it is necessary to use a ViewGroup object such as LinearLayout, RelativeLayout etc. hope that helps. On May 15, 3:06 pm, Neha nehathakka...@gmail.com wrote: Hi, Can we create a button on a canvas without defining the button widget in the layout file. ie there is no layout .xml file defined for the application. Urgent help required please. Thanks and Regards, Neha --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Fullscreen in Custom View
is there any method by which a custom view (eg a game screen) can occupy the full screen of the device? i.e. the menu bar at the top showing the application title, battery level, network strength etc is covered? ~thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Re: Android and Netbeans
i tried the same thing a few months ago. i managed to get the plugin installed and open up a new android project in netbeans. however the build kept failing. if i remember rightly, one of the forums mentioned that the netbeans plugin is unable to maintain the R.java file which is why the build failed. it might work if you are willing to make the effort to create and maintain the R.java file manually. in my case, i (reluctantly) switched over to eclipse. but trust me - eclipse is pretty decent once u get used to it. the built in XML editors are useful when u need to define the layouts and resources using XML. On May 4, 7:52 pm, ntuple ntu...@gmail.com wrote: Has anyone gotten Android to work on Netbeans ? I'm using the nbandroid plugin which works fine but I can't get to the next step of defining the Android Platform. Whether I point to the Android folder or the platforms subfolder or the 1.1 or 1.5 underneath, Netbeans refuses to recognize any of these as platform folders G ! This is on Kubunto 9.04 so it maybe that the Android Unix distro isn't recognized but it's really frustrating because I prefer to work in Netbeans. Without a workaround it seems the only choice is to use Eclipse to develop Android apps. thanks N. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] AnimationDrawable not starting
i'm trying to use an AnimationDrawable for frame wise animation. the problem is that when i render it on screen, only the first image in the Drawable is displayed. the animationDrawable.isRunning() returns true, however the images are not animated. following is the XML file (called whitepawnchanged.xml) and is stored in the res/anim folder ?xml version=1.0 encoding=UTF-8? animation-list xmlns:android=http://schemas.android.com/apk/res/ android android:oneshot=false android:id=@+id/upgradewhite item android:drawable=@drawable/whitebishop android:duration=100 / item android:drawable=@drawable/whiteknight android:duration=100 / item android:drawable=@drawable/whiterook android:duration=100 / item android:drawable=@drawable/whitequeen android:duration=100 / /animation-list the java code within the onCreate() method of the Activity is as follows ... (the relevant snippet) public void onCreate(Bundle icicle) { super.onCreate(icicle); . . ImageView whitePawnChange = new ImageView(this); whitePawnChange.setBackgroundResource(R.anim.whitepawnchange); whiteChange = (AnimationDrawable)whitePawnChange.getBackground (); //whiteChange is an AnimationDrawable object defined in the Activity) //rest of the stuff } the call to the whiteChange.start() is NOT in the onCreate and is fired later when a button is clicked ... typically well after the application is running. apparently other people have faced this same issue but i could not find any solution. any help would be greatly appreciated. incidentally, i'm also looking at a workaround (in case this problem persists) - is there any way that we can change the Bitmap associated with a BitmapDrawable AFTER the BitmapDrawable has been created? in the documentation i could only find a getBitmap() method and nothing along the lines of a setBitmap() or similar method. ~thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---
[android-beginners] Game Development Tutorials
Hi, I am new to Android Development and have managed to instal the SDK. I am primarily interested in developing games for the Android Platform. Could someone please suggest tutorials specifically for game development i.e. the relevant APIs and architecture? I saw the LunarLander Source Code in the documentation, but was unable to follow the code after a few lines. Is there any tutorial on this example (similar to the Notepad tutorial) that explains in detail what the code is doing? Thanks, --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Beginners group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~--~~~~--~~--~--~---