![]() | Chapter 3 section 5 About Box |
|
13 Dec 2010, 22:56
Morgan Kodysz (5 posts) |
So far this book has been an excellent start to learning android 2.2+, however once I reached chapter 3.5 implementing an About box. I have code errors that book doesnt mention. I am new to android and pretty much anything more complicated that HTML5 so I might come off inexperiences. Plus I am only 23. Ok Start Created the about.xml file and imputed the code. It registered correctly without error except the ending , this did not go away til I closed eclipse and reopened program. ?? Than it shows error: Error parsing XML: not well-formed (invalid token) <?xml version=”1.0” encoding=”utf-8”?> Moved on to create the src/org/example/sudoku/About.java file all the code registers except next to the setContentView(R.layout.about); there is a red x that says “R cannot be resolved to a variable. ?? This is with the same code as book no steps missed. Than I moved on to the src/org/example/sudoku/Sudoku.java This part of the book goes everywhere. He list code but assumes everyone knows where to add and where to edit it. Once I imputed the code after viewing the source code from the file download. Ever click listener will not register error code “button cannot be resolved or is not a field? Than after adding the
// ...
public void onClick(View v) {
switch (v.getId()) {
case R.id.about_button:
Intent i = new Intent(this, About.class);
startActivity(i);
break;
// More buttons go here (if any) ...
}
} Eclipse still registers “R.layout.main” as not a field case R.id.about_button: as not a field both in Sudoku.java and About.java all the other files created in project are showing good code. the next step in the excersise is to run app, but I can run the file it than shows this is red text at bottom of eclipse in the Android section [2010-12-13 15:22:19 – com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Morgan\workspace\Sudoku\AndroidManifest.xml: The prefix “adndroid” for attribute “adndroid:name” associated with an element type “activity” is not bound. Than I imputed the declaration for the activity in the AndroidManifest.xml as such <?xml version=”1.0” encoding=”utf-8”?> The book says to add the tag after the closing tag of the first one and I am assuming this is correct sense there is only one closing tag in the .xml file I didnt miss a step and started from 0 code so looking at his files doesnt help me learn. Also I am using the newest eclipse and latest android api/apk downloads. Please help Thanks |
|
13 Dec 2010, 23:08
Morgan Kodysz (5 posts) |
Fixed that typo error. But the other errors still remain. “[2010-12-13 15:22:19 – com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Parser exception for C:\Users\Morgan\workspace\Sudoku\AndroidManifest.xml: The prefix “adndroid” for attribute “adndroid:name” associated with an element type “activity” is not bound.” Thanks, Morgan http://i23.photobucket.com/albums/b389/mkodysz/... Direct link to screen shot of errors |
|
14 Dec 2010, 01:29
Ed Burnette (1316 posts) |
You have to be vary careful of spelling (e.g., adndroid should be android) and capitalization (scrollview should be ScrollView, minsdkversion should be minSdkVersion). Also you have to be careful to use real ASCII quote characters instead of the funny smart quote characters some word processors like to use (” should be
"). I made a few fixes in the AndroidManifest.xml file you posted and got this:Other tips:
|
|
14 Dec 2010, 03:01
Morgan Kodysz (5 posts) |
Thank you Ed Never saw those simple errors. Glad your there to help. Now i feel really crazy. I will follow the code you gave and try it. Morgan |
|
14 Dec 2010, 23:42
Morgan Kodysz (5 posts) |
After reviewing code ecplise still says the buttons are not feilds. Also says missing some file So I deleted both the hello project and the sudoku project and went to the api and sdk download and selected every package they have. Hopefully that works Morgan |
|
16 Dec 2010, 03:33
Ed Burnette (1316 posts) |
Hard to say without seeing the project, but sometimes you can get packaging problems if you have files in weird places. For example I saw somebody that had a “res” directory under their “layout” directory instead of the other way around. If you’re still stuck feel free to zip up your project and mail it to me (gmail.com account is ed.burnette) so I can point out what’s wrong and offer some diagnostic tips for next time. |
|
17 Dec 2010, 05:41
Morgan Kodysz (5 posts) |
Ok will do. When I have a free day I will create a new project and once I get to that section, if it has the same problems I will send you the project file. |
|
25 Dec 2010, 18:03
Ed Burnette (1316 posts) |
Ok. |
| You must be logged in to comment |

