0

私はしばらくの間、この 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);

何が問題なのかわかりません。構造的にコードは変更されていません。static final String KEY_SYNC_STATUS = "syncStatus"; による最初のエラー。トークン ";" の Synatx エラーです。{ このトークンの後に期待されます

OnCreate メソッドの 2 つのエラーは、Syntax Error on token "(" expected ; および Syntax Error on token ")" expected です。どんな助けでも大歓迎です

4

2 に答える 2

2

あなたのエラーはここにあります:

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

タイプがありません。アドレス、文字列とは? addedByPerson とは何ですか?

// XML Data to Retrieve
String Address = "";
String addedByPerson = "";
String addressCity = "";
...
于 2013-08-21T14:00:27.960 に答える