Hacker News new | ask | show | jobs
Ask HN: How to go from a Django app to Android app.
6 points by foobarram 5121 days ago
We have a properly structured Django app, which we now want to develop an Android app for with the same functionalities as the Django app. What is the most relatively pain free way going about achieving this? p.s: our devel team has no prior Android experience.
1 comments

The following metaphors are more or less accurate and helped me with the same transition (MVC web architecture to Android):

* Layouts are like views, though Android's XML layouts aren't able to have conditionals or logic like most web app templates

* Intents are like URLs, the Manifest file is like the router

* Activities are like controllers, you should aim to keep them "thin". This is also where callbacks for things like button clicks live

* You can use sqlite on Android, but there isn't anything like the Django ORM built-in

* SharedPreferences can act as a key-value store for small data (sort of like Redis I suppose)

If you can expose all of your app's functionality through an API, then you can just treat the Android app as an API client. If not (or if you want the app to be more than a wrapper), I would aim for the prototypical "thin controller, fat model" pattern and push all the business logic into plain Java objects if possible (so much easier to unit test).

Thanks a lot swanson for your detailed Django Android mapping. Actually, our idea is to create an API for the Django app, and come up with a wrapper for Python. However, our Django app requires users to upload files constantly, so I am not entirely sure if the API route is the right away - In any case, we are going to try this. Thanks again!
There is a fairly good ORM addition to SQLite that can be used on android. We are currently using it for one of our projects - http://ormlite.com/
Thanks for this info jat. I will look into this.