我一直在试图让这段Android代码工作一段时间,并且eclipse在不应该有这种情况时给我这样有用的语法错误。我检查了我的括号,我有正确的号码,我相信他们都是他们应该在的地方。这是从教程复制和粘贴的代码,稍作调整。所提供的代码完整地工作,但我的版本给出了错误。我没有改变那么多。对没有任何明显错误的令牌的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方法上的两个错误是令牌“(”expected; Syntax Error on token“)”上的语法错误;任何帮助表示赞赏
方括号在哪里结束onCreate和Activity? – Razgriz
括号全部出现并且正确,我对它们进行了计数并进行了双重检查(这里仅包含300行代码以便于阅读) –