I am trying to declare a message protocol that I want to use for exchanging data over UDP. So I would like to declare a bunch of string constants in another file so that I can reference them in my main activity when I am building a packet. I know this isn't right because I am getting errors, but this is what I would like to do...

public final class PACKET
{

    // Packet Protocol Version
    public final void REV ()
    {
        final String R_1_00                         = "1.00";
        final String R_1_01                         = "1.01";
    }

    public final void CMD ()
    {
        final String STAT                           = "STAT";
        final String STOP                           = "STOP";
        final String WAIT                           = "WAIT";

    }
}

That way when I am creating a packet in my main activity I can use PACKET.CMD.WAIT, or something like that. Is there a proper way to do this? Thanks

Related posts

Recent Viewed