Different projects, access to "both" projects classes.
Hello fellow java lovers.
I've stumbled into a problem.
I want to create a chat program that spans both windows and android.
Usually what I have been doing when using Sockets is sending all objects with an interface (i.e: ServerResponse, ServerRequest).
All objects could be cast to this type of interface and then execute the method within.
But now I want to make one that is compatible with Android as well, but I have no idea how I can split it up into one Android project
and one regular java project in Netbeans. Anyone have a way I can do this? Or any other way I got to use?
Kind regard, LG.
Re: Different projects, access to "both" projects classes.
What you need to do is very scrupulously separate out the non-GUI portions of your code to create its nucleus or "model", and then create different wrapper classes to allow the model classes to interact with either android or non-android gui. You will want to read up on the Model-View-Control or MVC design pattern.
Re: Different projects, access to "both" projects classes.
Thanks for the rapid reply. I'll look into that.
Edit: On another note,
the reason why I liked my method, I could make lets say, a LoginObject like this:
Quote:
public class LoginObject implements ServerRequest {
private String username;
private String password;
public void ServerWork() {
ServerSideDatabase.Authenticate(username, password);
}
}