Android Development: How do graphics work in Android? - android

I am an android development beginner with some experience in other object oriented languages like java, python, c#. So I have created various games before in Java, using buffers and graphics to draw lines and stuff. How do I do that stuff in android? I looked at some online guides, and they all seem to create a class to extend a View object, and the class will overrule the onDraw method, where they can cause the Canvas or something to draw a line.
But what if you want to draw a line based on user input? That method wouldn't work then would it?
For example, what is the simplest code for which I could draw a circle where the user touches the screen?
Also, i was wondering what books people would reccomend for beginners, especially one that includes stuff on graphics? I user the developer site for android, but I feel a book would also help a lot to understand android? Any suggestoins?
Thank you for your time, I greatly appreciate it!

There you go, this book is definitely what you need to read: http://www.amazon.com/Pro-Android-Media-Developing-Smartphones/dp/1430232676
what is the simplest code for which I could draw a circle where the user touches the screen?
Either use SurfaceView to draw or create a custom View handling onDraw() and onTouch()

Here is a suggestion ... load the API Demos app into Eclipse and explore the Graphics demo source code. There are a large number of graphics demos.
To load the API Demos app, in Eclipse click File > New > Other > Android Sample Project.
Then select your build target such as Android 4.2.
Then from the list of sample apps select the API Demos app.
And finally click Finish.
There are over 300 demos in the app, so it can be difficult to navigate. You want to look in the Graphics section.

"Android 2D Graphics with Canvas API" by Yevgen Karpenko is pretty good for beginners.
It explains basic concepts like coordinate systems and transformations, shows how to work with text and use different graphics primitives (lines, paths, circles, etc.). It also shows how to use multiple threads in graphics apps.
Below is the link for eBook version on Amazon.
http://www.amazon.com/Android-Graphics-Canvas-API-ebook/dp/B00DKIAVK8/ref=sr_1_8?s=books&ie=UTF8&qid=1374420538&sr=1-8&keywords=android+2d

Related

3d structure in android application

So, for a personal project, I'm trying to make an app that helps newcomers get used to the school quickly. And for one section of it, I'm trying to build a 3D Structure, in a shape of my school campus, with lables incidating where the rooms are, so when the using searches for specific rooms, they can easily find it. So, It would be like from one activity, when I click a button, it opens a new activity with a search bar on the top, and the rest of the screen a 3d image people can navigate through. What's a way I can accomplish this?
I know that the structure part can be accomplished with Unity, which I haven't learned but have an idea of what it is, but I don't know how to build the rest of the app with Unity.. So..
You probably want to start with designing the model (structure) in some-kind of modeling program, Maya, 3DS Max, Cinema 4D, Blender, etc... (Personally I recommend using Blender since it's free and open source). Then you would want to export it to some 3D model format, I recommend using .obj since it is very human-readable and easy to parse on your own, but you can use some other format and parse it using a library.
Now comes the more difficult part and it's to render the loaded model onto the screen. This can be accomplished with OpenGL ES or a more highlevel library which can abstract it for you. If you're not familiar with OpenGL ES or OpenGL in general, I wouldn't recommend using it since it may take some time to learn. There are few libraries out there which can render 3D models pretty easily. Now you should probably create some-kind of a controllable camera as well so you can use it to navigate through the model.
This maybe looks like a lot of work but if you already familiar with computer 3D graphics it can ease it up for you.
Well, you can make a 3d model of your school using Blender (which is a free tool, but will almost certainly be a lot of work). Export the model as a mesh which you can insert into your app as an asset or resource. Read the resource and present it using (probably) opengl. This is a SUPER high level view, in actual fact there's quite a lot of work in each stage. Some third party libraries can make it a little easier, but it will still be a big job. I personally like libgdx for abstracting the pain of opengl, but that's just my personal opinion.
It's a big job, but would be super cool .. good luck!
I recommend starting off with building the structure in a program like Blender, Maja or 3ds Max. You can export your projects from those programs to pretty much any game engine and it makes more sense to build things in one of those programs.
Once you're done with that you can choose which engine you want to use to add the search function, if unity or Unreal or whatever but either way you're going to need to make yourself familiar with java or c to add the search function.
I recommend to use blueprints of building if available, it will save you a loads of nerves. Use it as a material texture and place it on a plane polygon to get a good lining helper.
If you do use Unity for development then try Maya for polygonal modeling. At least they are looking similar to each other whereas 3DSMax is always a mind f*cking experience.

Are there simple AR SDK that does not use image recognition?

I'm looking for a 'basic' AR SDK that allows me to draw images and 3D shapes around the user (no matter where he is). It would be even better if the SDK includes a simple way to detect interaction with the shapes (something like onClick).
I made a project from scratch on Android but there's still a lot of work to do and I'll need to do the same on iOS after... So that's why I'm looking for an SDK or a similar project (no matter what platform).
I tested Metaio but it's quite expensive and maybe overkill for my purpose because it uses LLA coordinates.
I tested DroidAR on Android but it's only for Android and it looks heavy too (don't need the GPS).
How about Qualcomm's Vuforia? I was able to quickly get a sample project running on it.
EDIT Looks like I was wrong about what it could do. According to this (which is slightly dated, so who knows) Metaio might be your only choice.
i really don't sure what you really want to do ..but if you simply show images or 3d models on camera without any detection you can achieve this very easily i am explaining for Android and you can extend it to ios on same logic.
first approach:
you have to use custom camera of Android in your app,then use any game engine as per your need..i will suggest Jpct-ae or Rajawali
they are very simple to integrate and can be used for 2d images and 3d models.
this tutorial will explains a lot
keep the gl-surafce transparent and you can have model floating in space ...
second approach :
to add some more effect to your AR app you can use sensor values to move model in 3d space as per movement of device..it gives a cool effect.
use first approach and additionally collect sensor values and apply that matrix to gl camera of your game engine..for sensor values follow here
good tutorial here..
i hope this may help you..i done these a long time ago but try to help if you want..

Android platform game level editor

I'm trying my hand at making a platform game and have been thinking about what I would use to design levels.
I was thinking of using a tile palette that would contain the graphic tiles and their properties. And a similar palette that would contain sprites.
This way I could drag and drop tiles/sprites onto a grid and specify property values. This could all be saved to some kind of file that would be read by the game.
Without getting too into the details, is this a sound overall strategy? Is there anything major that I'm forgetting? Or perhaps there's a better method?
This is a rather open-ended question, but I don't think there is anything wrong with your approach. You might have to try a few things to find out what works for you.
When I make platform games I find it useful to be able to edit levels while I'm playing them, by adding in code to the game which allows me to select a graphic tile from a palette and paint it onto the screen. The behaviour is usually linked to the graphic for my games but you could paint behaviour as well. You then need code for your game to save levels as well as load them. Obviously, you would probably want to remove the editor before releasing the game.
I don't know how much experience you have with game dev, but if you're thinking about making a tile-based platform game then your best bet is leveraging existing libraries/tools to avoid "re-inventing the wheel". I highly suggest looking into open source libraries/tools because you can modify them to your liking. I've had some good experience with libgdx and AndEngine in which case both have TMX support which is a file format that can be used in conjunction with Tiled map editor. I personally like libgdx because it has javadoc and very actively developed, and also that it's a framework rather than engine which gives you more flexibility (although more coding in some aspects).

graphical representation in android

I stumbled upon this site today and found it quite intriguing.. Some of these apps have really stunning display of data, especially the norton mobile utilities. I want to graphically represent the information in my android application. I have researched a lot about graph librarioes available for android and have used chartdroid and achartengine, but still am not satisfied with the end result.
Which is the best charting library for android available for free?
They are probably using custom views overrinding the onDraw method to plot lines, shapes and paths using the canvas or the surface of the view.
Have a look http://mindtherobot.com/blog/272/android-custom-ui-making-a-vintage-thermometer/

How to start with 2D

Ok my question is simple:
How do I start working with 2D graphics on android? Untill now,I found on the how to make almost anything on Android,however with graphics I see is harder.
On the android sdk website,I get some simple codes that don't really help me,and I also searched for a book,guess what,I didn't find one that actually shows you how to make a little game explaining me what does every line of code.
So: How do I start working with 2D graphics? I'm interested because I want to make some games.I would be very happy to find a tutorial for ex. that shows you how to make a little character that just jumps over a box.I know you need an engine and all that stuff,and I would actually want to learn how to make a little engine.
libGDX runs on Android (and a few other platforms) and provides high level 2D graphics features like sprites, fonts, tile maps, particles, etc.
Tutorials here.
A few complete demo games with source code here.
Here's a whole series that seems pretty decent, and starts from the beginning.
Also, the techniques of "generic" 2D programming apply, so general-purpose game engine information is useful as well.
If you are interested in android games(2d), I recommend this book http://www.amazon.com/dp/1430230428/
The following book is very good for learning 2d graphics in Android.
"Android 2D graphics with Canvas API".
http://www.amazon.com/Android-Graphics-Canvas-API-ebook/dp/B00DKIAVK8/ref=sr_1_8?s=books&ie=UTF8&qid=1374420538&sr=1-8&keywords=android+2d
It is not for game developers though.
It teaches how to use graphics primitives and work with different coordinate systems. It also has a chapter on multithreading.
It has many simple examples good for beginners.

Categories

Resources