views:

228

answers:

2

When I try to add a strServerIP to the class Server, I get a:
Cannot resolve symbol string
compiler error.

Why?

package com.example;


public class Server
{
    //public static java.lang.string SERVERIP;
    public static android.R.string SERVERIP;
    public static java.lang.string strServerIP = "monster.idsoftware.com";
    public static string strServerIP = "monster.idsoftware.com";
    public static int SERVERPORT = 27950;
    public static int PROTOCOL = 68;
}
+5  A: 

Use "String" not "string"

RickNotFred
Oh lol, damnit, I knew Java is case-sensitive, but as somebody else already said: "it's 'almost' like C". The almost is unfortunate.
Quandary
+4  A: 

In addition to RickNotFred's answer, android.R.string is not a data type, and you are using it as such in the first line of your Server implementation.

If you are new to Java, I definitely recommend spending some weeks learning Java outside of Android. Android's use of Java is just strange enough that some people seem to get frustrated learning both at the same time. Also, books on Java will not have Android in mind, and books on Android pretty much assume you already know Java.

CommonsWare
actually, I'm writing a UDP client to query the ID Software master server. It won't be easy, but I'll survive.
Quandary