Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Possible Duplicate:
Is Model-View-Presenter (MVP) scheme useful for Android?

I've started coding for Android and I'm having difficulty trying to properly partition my code. I always end up with a very tight coupling between my UI logic and the actual controls I use to represent them.

I have background in both WPF MVVM and ASP.NET MVC so I'm familiar with those patterns. After some digging, I found Android Binding. It seems nice and fits nicely with my WPF background. However, it bugs me that its not built in. I'm pretty sure that the Android makers have thought of this when designing the Android programming interface. So my question is, what is the best practice pattern to use when developing in Android, if any. I have looked and looked at their site but didn't find anything...

share|improve this question
1  
I answered a similiar question here - I believe it will apply to your question too. –  Michael K Apr 5 '12 at 12:34
    
I believed when the Google people designed this SDK, is assuming that the mobile devices are limited in CPU and RAM. MVVM or Presentation Framework requires relatively larger amount of processing (to handle data notifications). That's basically technical consideration rather than good or not. With the advance of Android devices, I can't see why MVVM is not a possible contender in Android; especially if you believe WPF is better than Window Form. –  xandy Apr 27 '12 at 9:14
add comment

marked as duplicate by Dynamic, Glenn Nelson, gnat, Robert Harvey, AProgrammer Dec 29 '12 at 13:08

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

When I start work on Android I know about MVC. Now I try to make Android app using MVC but when I start I success but here I write many lines of code without any purpose. And at the end my app having many line of codes which are only write for making MVC. Not for functionality. But now I am using my own design which is very good for me I make many big apps with this approach.

I give you small example or if you need more help I send you some template of code.

First decide what are the main functionality of your app like Your app having tabs or having only lists.

Instead I made scenario of an app at run time. Now suppose we have an app which save some data on local DB and it also get data from Server in JSON. After that I have list to show JSON data. And there are some sounds also play in the app in background. Now I also want to show data from mobile contacts. And also want to add social integration like FB etc.

Now start of code.
First create packages:

1.com.app.startup/splash (Splash + Initialization of any view here)
2.com.app.general (Made Application Object + Constant file where save constants)
3.com.app.functionalities (Any functionality like Map,Social media etc)
4.com.app.webservices (Mostly Async task which load data from Server)
5.com.app.jsonparsers (Used in webservices to parse json and save in model)
6.com.app.models (Create your models)
7.com.app.adapters (Because many list so make list here)
8.com.app.main (Here mostly main activities code like dashboard, ListsActivities)
9.com.app.interfaces (Create interfaces which create easiness in working with ListActivities and adapters)

I think now you can handle any project in Android in this manner.

share|improve this answer
2  
You should consider adding a basic diagram on how this classes interact for better understanding of your option, otherwise I am afraid is not very useful. –  Picarus Sep 30 '12 at 20:25
    
Picarus it is not possible for me to make a class diagram due to time but i send you some small template of code on Sunday. when i free. If u have any scenario please send me i send you template of code. And i think you are right at this time. It is your wright to afraid from my answer. –  Hafiz Waleed Hussain Oct 1 '12 at 18:55
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.