Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat's the right design approach for writing an application for both Android and J2ME by maximizing code-reuse?
    primarykey
    data
    text
    <p>Most people are asking about migrating from J2ME to Android. I'm not. I'd like to develop applications and have them work on both Android and J2ME. Obviously for each application I will have an Android project and a J2ME project and both will source in a shared dependent project that will have common code.</p> <p>I'd like to know what do people think the right design approach should be to maximize code reuse (maximize the code in the shared project).</p> <p>In my typical J2ME application there is a controller/model and a bunch of views.<br> So each view holds a reference to the controller and when the user interacts with the view, the view invokes a method of the controller and the controller decides which view should be displayed next and what data it should have in it. The views don't know about each other. I would expect the controller/model code should be mostly reusable if written properly. </p> <p>The question is: How does this 1 controller to many views translate to Android where each activity performs a subset of the whole application? </p> <p>One approach would be to have a single activity (the controller code in it).<br> That means the application would have to handle Back (as it would anyway for J2ME).<br> It also means that when <code>onAddContextMenu</code> is called it would have to know which kind of page is currently being displayed to add the page specific context menu.</p> <p>Another approach would be the following: each application view becomes an activity and the model-controller is passed around from one activity to another.</p> <p>Any opinions which is better? other approaches?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload