令牌上的Eclipse语法错误,没有任何明显错误

时间:2013-08-21 13:57:48

标签: java android eclipse

我一直试图让这段Android代码工作一段时间,而eclipse正在给我一个非常有用的语法错误,而不应该有一个。我检查了我的括号,我有正确的号码,我相信他们应该是他们应该在的地方。这是从教程中复制和粘贴的代码,并稍加调整。完整提供的代码可以正常工作,但我的版本会给出错误。我没有改变那么多。

public class MainActivity extends Activity{

Button Pull_Data; 


// Define the TextViews

TextView client_Address1;
TextView client_Address2;
TextView client_Address3;
TextView client_Id;

// XML node keys
static final String KEY_ITEM = "Address"; // parent node
static final String KEY_PERSON = "addedByPerson";
static final String KEY_CITY = "addressCity";
static final String KEY_LINE_ONE = "addressLineOne";
static final String KEY_LINE_TWO = "addressLineTwo";
static final String KEY_STATE = "addressState";
static final String KEY_TYPE_ID = "addressTypeId";
static final String KEY_ZIP = "addressZip";
static final String KEY_CLIENT_ID = "clientId";
static final String KEY_COUNTRY_CODE = "countryCode";
static final String KEY_OBJECT_ID = "objectId";
static final String KEY_RECORD_ADDED_DATE = "recordAddedDate";
static final String KEY_RECORD_UPDATED_DATE = "recordUpdatedDate";
static final String KEY_RECORD_UPDATED_PERSON = "recordUpdatedPerson";
static final String KEY_SYNC_STATUS = "syncStatus"; //Syntax error is flagged here

// XML Data to Retrieve
Address = "";
addedByPerson = "";
addressCity = "";
addressLineOne = "";
addressLineTwo  = "";
addressState  = "";
addressTypeId  = "";
addressZip = "";
clientId = "";
countryCode = "";
objectId = "";
recordAddedDate = "";
recordUpdatedDate = "";
recordUpdatedPerson = "";
syncStatus = "";



// Holds values pulled from the XML document using XmlPullParser
String[][] xmlPullParserArray = {{"Address", "0"},{"addedByPerson", "0"},{"addressCity", "0"},{"addressLineOne", "0"},{"addressLineTwo", "0"},
    {"addressState", "0"},{"addressTypeId", "0"},{"addressZip", "0"},{"clientId", "0"},
    {"countryCode", "0"},{"objectId", "0"},{"recordAddedDate", "0"},{"recordUpdatedDate", "0"},
    {"recordUpdatedPerson", "0"},{"syncStatus", "0"}};


int parserArrayIncrement = 0;

// END OF NEW STUFF


@Override
protected void onCreate(Bundle savedInstanceState){ //Another error here, tagged at the first paren after onCreate
    super.onCreate(savedInstanceState);

我不知道可能出现什么问题。从结构上讲,代码没有改变。静态最终字符串KEY_SYNC_STATUS =“syncStatus”的第一个错误;是令牌“;”上的Synatx错误,{在此令牌之后预期

OnCreate方法上的两个错误是令牌上的语法错误“(”预期;令牌上的语法错误“)”预期;任何帮助表示赞赏

2 个答案:

答案 0 :(得分:2)

您的错误在这里:

// XML Data to Retrieve
Address = "";
addedByPerson = "";
addressCity = "";

您错过了类型。什么是地址,字符串?什么是addPyPerson?

// XML Data to Retrieve
String Address = "";
String addedByPerson = "";
String addressCity = "";
...

答案 1 :(得分:0)

这是什么?它不是Java类的有效部分:

//XML Data to Retrieve
Address = "";

Eclipse有自己的编译器,试图按部分编译文件。它被称为增量编译器。 也许它只是不能将你的课分成可编辑的块?尝试解决这些问题。