Question

I develop application for android and kindle. I want to use one layout for two devices, is that possible or I should provide layout for android and kindle separately? Сan I separate functional implementation from ui, to avoid developing 2 projects at the same time?Does Kindle have some restrictions(sound, authorization, repository work) or it is of full value Android device?

Was it helpful?

Solution

To separate functional implementation UI, look at the MVC design pattern. http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller

It's separated into Model-View-Controller packages.

Basically, the "View" class(es) are the UI, the "Model" contains is your data and business logic, and the controller extracts data from the "View" and passes it to the "Model". This is a very effective way of separating the UI from the implementation and either give different views of the data or have completely different user interfaces altogether.

Example:

Model: Employee.java
View: MainGui.java
Controller: Controller.java

It is important to note that the controller links the model and the view together. At no point in the code should the Model directly reference the View (or vice versa). The controller usually also has the Main method, though some people like to have a separate "EntryPoint" class.

Check this page for a quick tutorial on MVC, it's excellent. I've used MVC on work countless times. http://www.austintek.com/mvc/

With regards to the "Kindle", if you mean a Kindle fire, then it runs a forked version of android which may have some missing or additional functionality.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top