MapApp3 : Writing a tiles manager
Welcome to the third part of my tutorial on how to create a map app for Android from scratch and –>without<– using Google™ APIs :P.
Series outline:
- Series aim.
- Theory you need to know.
- App design.
- Writing a TilesManager.
- Writing a TilesProvider.
- Seeing results with MapView.
- Adding web support.
- Creating MapView in XML.
- Extra: Fuchs Maps.
______________________________________
Okay, as I said earlier the TilesManager will provide us with calculations needed to get the right tiles and render them in the right place.
TilesManager will have some state variables: position in degrees (longitude & latitude) plus a zoom level.
Using these state variables the TilesManager should be able to provide us with a rectangle (left, top, right, bottom) that contains the indices for the tiles, for example if the rectangle was like (0,3,2,5) it means we should fetch any tile that satisfies:
where zoom is the zoom level stored in the tile manager.
First we need to write a helper class, PointD is just a double Point which Read more…
MapApp2 : App Design
Welcome to the third part of my tutorial on how to create a map app for Android without using Google™ APIs :).
Series outline:
- Series aim.
- Theory you need to know.
- App design.
- Writing a TilesManager.
- Writing a TilesProvider.
- Seeing results with MapView.
- Adding web support.
- Creating MapView in XML.
- Extra: Fuchs Maps.
______________________________________
Okay, I’m supposed to show you a class diagram here but I changed my mind, since the app is simple I’ll explain each class in some lines :).
TilesManager: this class contains all the calculations needed to power our app, as I mentioned before maps are made up of tiles, we need to know exactly what tiles to fetch, we also need to convert latitude and longitude to pixel coordinates to display markers, this class by itself doesn’t contain the tiles, it just provides us with methods to Read more…
MapApp1 : Theory you need to know
Welcome to the second part of my tutorial on how to create a map app for Android without using Google™ APIs :).
Series outline:
- Series aim.
- Theory you need to know.
- App design.
- Writing a TilesManager.
- Writing a TilesProvider.
- Seeing results with MapView.
- Adding web support.
- Creating MapView in XML.
- Extra: Fuchs Maps.
______________________________________
In this part I’ll give simple information about maps and some terms and how they are used, hopefully saving you some time of searching.
Since I’m not a geography expert, please note that some information here might not be accurate, corrections are welcome 🙂 after all I’m just a programmer who learned what he needs to accomplish his goal.
I’ll provide additional links for further reading at the end of this post.
Earth shape : although the earth isn’t a perfect sphere, some map systems treat it as a sphere, I guess that’s okay for everyday use.
Map projection : from Wikipedia: “A map projection is any method of representing the surface of a sphere or other three-dimensional body on a plane. Map projections are necessary for creating maps. All map projections distort the surface in some fashion. Depending on the purpose of the map, some distortions are Read more…
Building an offline map app for Android
Hello there :), this tutorial series is about building a very simple map application for Android from scratch and without using Google™ APIs
(Don’t get frightened by the scroll bar of your browser 😀 the comments made this post look long 😀 )
The main app features will be:
- Displaying a map stored in a database on the SDcard, in other words : offline* map, no internet connection is required (but easy to implement online functionality).
- User can touch control the map (Panning), zoom in\out using volume keys.
- A marker will be displayed on the map depending on the user’s GPS position.
*Update 16/8/2012: online maps are now supported in tutorial part 6
as mentioned before : we’re not going to use Google™ APIs.
As you can see the app will be simple, other more complex functions can be added later.
Q: Why not use Google™ maps APIs (eg: MapActivity)?
A: it requires a working internet connection.
A: you might want to write your own classes.
A: you might want to know how things work.
Q: Aren’t there free map apps on the Android Market?
A: Yes there are and they are really good ones, Locus Free, RMaps, Orux Maps, these apps can run with both online and offline modes, I mainly use Locus Free, but I like writing my own apps and learn new things.
before starting this tutorial I’ll show you the final result, so that you can decide whether to continue reading or not
The app and the tutorials target API Level 7 as a minimum SDK (That’s Android 2.1 )
Here’s the source code (Eclipse Project) and the apk file, after you install it on your device\emulator, copy this map file world.sqlitedb to your /sdcard/mapapp/ (You’ll need to make the folder yourself).
Read more…
Blog is back!
Sorry about the blog being deactivated 😐
It was an error, I reported the problem and the guys at WordPress fixed it the same day 😀
Thank you WordPress :D!
You cannot imagine how happy I’m to have my blog back 😀
Right now I’m learning Android application development and I guess I have some tutorials in mind :).
See you soon!.
Hex Screen
Intro:
Hello, it’s been more than three months since my last post, it’s also been more than three months since I last opened Visual Studio :(. A few days ago I decided that I should write something with XNA, that’s when I decided to write Hex Screen :D.
Hex Screen?
Hex screen is a 3D screen made up from hexagons, the cool thing about this screen is that hexagons can be animated to give nice effects, hexagons can be rotated, moved and scaled.
Another screenshot 😀 :
FuchsGUI Update
Hello there, sorry for being inactive lately but I don’t feel like programming or learning something new :(.
Anyway, I fixed the issue in FuchsGUI where some text was blurry, the reason was that the text was being rendered with floating point values for position, something like (20.3f,29.4), this meant that spriteBatch should split physical pixels :(.
Anyway, thanks to a guy named Fab who told me how to fix this, the solution was something like this:
position.X = (int)Position.X; position.Y = (int)Position.Y; // Render here
So, here’s the fixed version (XNA4 only):
FuchsGUI v1.1 Source Bin XNA4 (Blurry Text Fixed)
I hope to see you later :)…
RobotWarz Alpha Release
Introduction (a boring one maybe 😉 ?)
Good morning\evening or whatever suites your timezone :).
I’ve been waiting for this :D!, I’ve finished programming the alpha release of the game.
The reason I’m publishing it right now is because It might take me some time to have a full game, so by publishing an alpha release I can get opinions & suggestions from people which will encourage me to complete the game.
This release isn’t meant for end-users but rather for fellow programmers.
Unfortunately my laptop doesn’t have a graphics card so Read more…
RobotWarz Demos
Hello there :D, Sorry for the delay but I’m having some really serious internet problems :(.
Here are three videos of my XNA game RobotWarz uploaded on YouTube.
1- RobotWarz Demo:
just me playing against AI robots, I destroy them, they destroy me, it’s full of action :D.
2-RobotWarz Features:
this video demonstrates most of the techniques I used in the game such as Read more…
Stay tuned :P
Three videos of my game RobotWarz are coming soon…
One week after that I will publish the game here on the blog 😛
Here are two screen shots 😉