Results 1 to 3 of 3
Like Tree1Likes
  • 1 Post By Fubarable

Thread: Different projects, access to "both" projects classes.

  1. #1
    LG87 is offline Member
    Join Date
    Jun 2011
    Posts
    8
    Rep Power
    0

    Default 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.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default 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.
    LG87 likes this.

  3. #3
    LG87 is offline Member
    Join Date
    Jun 2011
    Posts
    8
    Rep Power
    0

    Default 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:
    public class LoginObject implements ServerRequest {
    private String username;
    private String password;

    public void ServerWork() {
    ServerSideDatabase.Authenticate(username, password);
    }
    }
    Last edited by LG87; 03-27-2012 at 11:30 PM.

Similar Threads

  1. Replies: 1
    Last Post: 12-09-2011, 01:18 PM
  2. Replies: 1
    Last Post: 03-24-2011, 03:01 AM
  3. Replies: 1
    Last Post: 01-23-2011, 01:12 AM
  4. Replies: 2
    Last Post: 04-03-2009, 03:03 PM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •