1

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?

Paul
  • 123
  • 1
  • 8

1 Answers1

1

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.

Harry
  • 74
  • 2
  • 9
  • I agree. I recently tested my app on a Kindle fire, basically it works, but craches quite often, for example it crashed while trying to access the android MediaStore class.. Didn't give it much attention since that was just an experiment – Droidman Feb 19 '13 at 08:51
  • what means "forked version"? – Paul Feb 19 '13 at 08:53
  • It basically means a modified version of Android. – Harry Feb 19 '13 at 08:56
  • can I provide for android and kindle the same design and layout files(xml) or they are incompatible? only kindle fire runs forked version? – Paul Feb 19 '13 at 09:17
  • Don't have experience with that. You'll have to run some tests and find out. – Harry Feb 19 '13 at 09:33