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.

I'm working on an online game, which I am seriously considering writing a Java Applet for it. The game is not overly complex on the features. I'm considering at some point having at least 3 versions of the game, which include a Java stand alone, applet, and Android game. I know from Design Patterns that the best way to use differing things like buttons and the like is to use a Bridge interface, where I have a common template for the common buttons.

However, I'm having a bit of difficulty understanding what to do about the following. I know that Android programs use an Activity structure, which I am well familiar with, and that Applets extend the Applet interface, which I am not as familiar with. I also know that a stand alone java program uses basically a main() function, which doesn't have much structure. I'm convinced that there should be a way to design a common design pattern between the two, but somehow I'm missing what that is exactly. What can I do to make the different frameworks work with as much common code as possible?

share|improve this question
1  
Have a look at libgdx. It's a framework which lets you deploy your game to Android, Desktop and to a browser using WebGL. –  Matsemann May 3 '12 at 9:10
add comment

2 Answers

up vote 1 down vote accepted

According to the answers to stackoverflow: recommended-ways-to-produce-app-portable-between-android-and-other-platforms the best way is

 keeping UI and biz logic / model separate

and writing seperate gui-s for android, applet, j2se, j2me.

But eaven keeping biz logic seperate is difficuilt because in the android world many api-s are based on the android Context which is the gateway to the operating system.

i have developped crossplatform biz logic for j2se and j2me for 2 projects. but i failed to do crossplatform for j2se/android because database and android-Context-api-s where to different from j2se.

share|improve this answer
add comment

Maybe there isn't a reason for creating a JApplet to use Java Web Start.

share|improve this answer
    
The question still remains then, how to design a program that will work well both in an Android environment, and the web start environment. –  PearsonArtPhoto Mar 4 '12 at 0:54
    
@Pearsonartphoto directly not possible, Android required emulator for standalone PC (plus a few restrictions on Windows OS), I don't know about embedded emulator to the browser, mojor of issues is another processor hierarchy and structure, sure may be not true and Intel (Android, Win7, Symbian) will change that –  mKorbel Mar 4 '12 at 7:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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