Fuchs Maps

05/03/2013 43 comments

Sometime ago after I finished my tutorials for Android offline map app I spent some time adding more features to the simple app, I guess I should share the code since many of those features are expected from any map application.

The post here won’t contain detailed explanation about how each feature is implemented since each feature might require it’s own post. Anyway if you’ve been reading my previous tutorials everything here should be straightforward and easy to understand, consider the source code provided here as some sort of raw data that someone might benefit from 🙂 .

This code is built upon the offline version of the app, so it doesn’t have web tiles support and the mapView cannot be created in xml (these can be changed easily by following the previous two tutorials).

The code isn’t perfect either, it does the job though 🙂 .

Here’s the features list:

The post will contain lots of images so please be cautious :).

Read more…

Categories: Android, Maps Tags: , ,

Simple Spring Physics

02/03/2013 8 comments

A few weeks ago (during exams period 😛 ) I was playing with spring physics, it turned out to be easy to implement and the results were cool enough for me to write a demo in Android, Microsoft XNA, and Javascript :D.

SpringLab img

Before I talk too much, here see the results for yourself, this is the web version :  SpringLab Web Version.

Reminds you of World of Goo 😀 ?

I came across this tutorial, from which I learned this lovely vector equation:

 F = -k(|x|-d)(x/|x|) - bv

I applied it to 2D springs and it gave amazing results especially when Read more…

Android Terrain Test 2 : Clouds

26/02/2013 11 comments

So I again went playing with OpenGL ES 2 on Android, this time I added clouds to the terrain:

Clouds_Screenshot

Not only that but I also learned new things about OpenGL ES 2 and fixed some deadly bugs in my previous code and reorganized the code in a better way.

Here are some screenshots showing the results of using different textures and different Read more…

MapApp7 : Creating MapView in XML

26/02/2013 15 comments

Hi :), welcome to the 7th part of my tutorial on how to create offline\online map app for android.

Series outline:

______________________________________

So once again it’s an unplanned tutorial and it’s about maps 😀 .

The thing is that I got a number of comments asking about how to create the mapView in XML instead of creating it in java code, what we’ll achieve here is:

  • Make the mapView creatable from XML.
  • Assign a zoom level to the mapView in XML.
  • Adding a position marker (drawable) to the mapView from XML.
  • Add ZoomControls to the layout containing the mapView in XML.

Here’s how the final result should look like:

MapApp with ZoomControls

MapApp with ZoomControls



And just a note before you continue reading: you can add the mapView in XML like any other view, one difference though is that you cannot rely on using wrap_content in the view, since there’s nothing to wrap (something like text in a button for example) but this is not end of the world, you can either using fill_parent or use 0dip with android:layout_weight, only then the mapView will play nicely with other views :).

So either use a RelativeLayout and put your mapView and other views in it, or use LinearLayout and supply weight values for your views.

So if you’re still reading this please download the source code (along with the empty database) from MapApp 6 : Web Support since I’ll be building on the code from that tutorial. Just please remember to put the database World.sqlitedb in the folder /mapapp/ on the sdcard.

The steps we will have to do are Read more…

Categories: Android, Maps, Programming Tags: , ,

2012 in review

01/01/2013 2 comments

The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.

Here’s an excerpt:

4,329 films were submitted to the 2012 Cannes Film Festival. This blog had 27,000 views in 2012. If each view were a film, this blog would power 6 Film Festivals

Click here to see the complete report.

Categories: Uncategorized

Android front camera app

21/10/2012 3 comments

So my friend has a Samsung Galaxy SII, unfortunately the back camera isn’t working anymore, the front one is working and he was able to test it using a built in testing utility that only shows a preview with no photo taking functionality.

The problem with most (all maybe?) camera apps is that they first check the back camera and then crash since the camera isn’t working!. Using an old camera project of mine I removed most of the features (flash, focus, geo tagging, saving images to database with encryption) and changed the app to use the front camera using Camera.Open(1), so now he can use the front camera :).

The reason I’m posting this is that the app might help if someone has a similar problem.

I found some apps that only use the front camera but some of them were laggy and I already had my own app half ready :D.

Here’s the apk with the source Read more…

Categories: Android, Programming

Android terrain test

19/10/2012 18 comments

Hello :), a while ago I decided to learn OpenGL ES 2.0 in Android, so I decided to make a simple terrain, and now I want to share my thoughts about this experience :D.

Edit: after reading this post please take a look at Android Terrain Test 2 : Clouds where the code is better and bugs are fixed (clouds were added too 😛 ).

Terrain in landscape mode


  1. Difficulties
  2. Video
  3. Download apk and source
  4. WebGL Version!
  5. Helpful tutorials
  6. notes



Read more…

MapApp6 : Web support

16/08/2012 19 comments

Hello, welcome to the 6th part of my tutorial on how to create an offline? map app without using Google™ API, okay this time it’s no longer offline :D! now the app will be able to download tiles from the internet :D!.

Series outline:

______________________________________

At first I planned on writing some basic tips about web tiles server support but then I realized that implementing web support needs some work and code organizing since multi threading becomes a must!. You cannot wait for the tiles to be downloaded in the UI thread!.

We will assume that you have a running tiles server that provides you with tiles you specify using a custom url like this:

http://myserver.com/?x=1&y=3&z=0
or

When we want a specific tile we first search if we have it in our memory cache, if we don’t then we search in the database, if we fail to find it then we download it from the internet.
It’s kind of similar to multi cache levels in a cpu, if one level fails it gets the requested data from the next level, when data found in a certain level all lower levels save a copy of the data since it’s highly likely to be asked for the same data in the near future.
In our case when you don’t have a tile in memory or in database you get it from the web server and then save it in the database and keep it in memory for later use.

We’ve already implemented the first two levels (Memory & database) in the tutorial part 4, the TilesProvider class covered them both. but we didn’t have any threading manipulation, this time we have to be very careful about threading stuff. We will implement new classes and modify some of the old ones, the changed lines in existing classes will be highlighted in grey. Also note that if you’re using Eclipse as your IDE you can always count on the keyboard shortcut Ctrl+Shift+O to automatically import the right packages.


We will add three source files to our project in a new package called com.mapapp.tileManagement.web

Let’s first implement the class TileDownloadTask, this class handles Read more…

Categories: Android, Maps, Programming Tags: , ,

MapApp5 : MapView and Activity

06/04/2012 64 comments

Welcome to the fifth and final part of my tutorial on how to create a map app for Android without using Google™ APIs :).

Series outline:

______________________________________

So up until now we didn’t see any results :(, this is where everything changes :D.

In this part we’ll write three classes:

MapView: a custom view to render and manipulate the map.

MapAppActivity: the main (and only) activity for the app, mainly creates the MapView and handles activity state changes.

MapViewLocationListener : An extended LocationListener that knows how to deal with a MapView.


MapView:

First thing you should know about this view is Read more…

Categories: Android, Maps, Programming Tags: , ,

MapApp4 : TilesProvider

23/03/2012 3 comments

Welcome to the fourth part of my tutorial on how to create a map app for Android without using Google™ APIs :).

Series outline:

______________________________________

So now we have a TilesManager to do all the math for us & provide us with tile indices, we still need something to give us the actual images of the tiles, this is what TilesProvider does each time our MapView asks for tiles images the TilesProvider will load the data from the Database then return them to the MapView.

Each time we need to get our tiles images we fetch the data from the map database and convert the data into a Bitmap that can be rendered in our MapView, querying the database is relatively a slow operation, to make it worse, building a Bitmap also needs some time, so we must implement some sort of optimization, I’m leaving the database part and focusing on the Bitmap creation.

Instead of recreating a new Bitmap each time we check to see if Read more…

Categories: Android, Maps, Programming Tags: , ,