 |
BOOK: Beginning Android Application Development
 | This is the forum to discuss the Wrox book Beginning Android Application Development by Wei-Meng Lee; ISBN: 978-1-1180-1711-1 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning Android Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

December 21st, 2011, 06:58 PM
|
Authorized User
|
|
Join Date: Dec 2011
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
activity error
I am trying out the first exercise, but get this error:
Code:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (classFileParser.cpp:3470), pid=4336, tid=2528
# Error: ShouldNotReachHere()
#
# JRE version: 7.0_01-b08
# Java VM: Java HotSpot(TM) 64-Bit Server VM (21.1-b02 mixed mode windows-amd64 compressed oops)
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# C:\Users\myUsername\workspace\Android\hs_err_pid4336.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
#
|

December 21st, 2011, 09:08 PM
|
Authorized User
|
|
Join Date: Nov 2011
Posts: 86
Thanks: 3
Thanked 5 Times in 5 Posts
|
|
Hi droidus
The java errors are hard to figure out. Post your code and maybe someone will spot your error.
Cliff
__________________
"Software to the Stars"
Failure is not an option. It comes bundled with your Microsoft products.
|

December 22nd, 2011, 01:51 PM
|
Authorized User
|
|
Join Date: Dec 2011
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
|

December 22nd, 2011, 09:09 PM
|
Authorized User
|
|
Join Date: Nov 2011
Posts: 86
Thanks: 3
Thanked 5 Times in 5 Posts
|
|
1. in the AndroidManifest.xml file change android:name to .MainActivity.
android:name=".MainActivity"
You may have done this, but you did not sent the manifest file.
2. Line 39 in MainActivity needs the name of the activity you are trying to start.
change
Intent i = new Intent("com.Android");
to
Intent i = new Intent("com.Android.ACTIVITY2");
Now it still can not find activity2. I do not know why.
The error message is:
12-22 18:56:53.706: E/AndroidRuntime(829): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.Android.ACTIVITY2 (has extras) }
Maybe someone else will know why.
It may be that your naming convention (com.Android and not com.Android.Activities).
3. General observation.
It appears you downloaded the code and just modified it. You should type in the code, yes I know its a pain, but that is how you learn.
Hope this helps some
Cliff
__________________
"Software to the Stars"
Failure is not an option. It comes bundled with your Microsoft products.
|

December 22nd, 2011, 09:24 PM
|
Authorized User
|
|
Join Date: Nov 2011
Posts: 86
Thanks: 3
Thanked 5 Times in 5 Posts
|
|
it works
The problem is in the manifest file. You need to add the following:
Code:
// new activity 2
<activity
android:label="Activity 2"
android:name ="Activity2"
>
<intent-filter >
<action android:name="com.Android.ACTIVITY2" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity
after the end of the first activity and before the </application>.
around line 20.
Cliff
__________________
"Software to the Stars"
Failure is not an option. It comes bundled with your Microsoft products.
|

December 23rd, 2011, 12:16 PM
|
Authorized User
|
|
Join Date: Dec 2011
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
thanks for the advice. i updated my code to show what it now looks like. still doesn't seem to run, after making the changes.
here are my files:
http://www.mediafire.com/?elh54lzfwizk2sm
http://www.mediafire.com/?bh7gg4nyj9rho0x
http://www.mediafire.com/?w7xwlx5q0fii3kz
http://www.mediafire.com/?zity55s004t626t
i get this error still:
Code:
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (classFileParser.cpp:3470), pid=6132, tid=5532
# Error: ShouldNotReachHere()
#
# JRE version: 7.0_01-b08
# Java VM: Java HotSpot(TM) 64-Bit Server VM (21.1-b02 mixed mode windows-amd64 compressed oops)
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
Last edited by droidus; December 23rd, 2011 at 12:21 PM..
|

December 23rd, 2011, 07:54 PM
|
Authorized User
|
|
Join Date: Nov 2011
Posts: 86
Thanks: 3
Thanked 5 Times in 5 Posts
|
|
Hi droidus
First line 39 of MainActivity should be:
Intent i = new Intent("com.Android.ACTIVITY2");
Activity should be in caps.
Also my Eclipse complains about the @Override in activity 2 & 3 at line 39 in 2
and line 23 in 3. This is just before the 'public void onClick(View view)' line.
They should be removed if eclipse says there is an error.
Other than that it runs.
It would seem that you have an error in your eclipse set up. Did you follow the instructions in the book when you set it up? None of the errors I get look anything like what you have posted.
If you still have a problem, tell us exactly what you are doing. What you have highlighted and how you start the program.
What I do is select the package name or MainActivity in the package explorer and press the 'run' button or the 'debug' button.
Do Not select the manifest or anything in layout.
Hope this helps
Cliff
__________________
"Software to the Stars"
Failure is not an option. It comes bundled with your Microsoft products.
|

December 24th, 2011, 01:12 PM
|
Authorized User
|
|
Join Date: Dec 2011
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
alrighty, thanks for your help! will have to play around with the code some.
just going back to some previous posts, what code should i manually type out? i noticed that the code for the exercises is not in the book. do i just download the code, and manually write that out?
also, when running the downloaded programs, i am not sure how to run them. i use eclipse. i see the .classpath, .project, AndroidManifest.xml, etc., but not any of the other ones, such as layout.activity2, or any of the src files. is there a simple way to import the whole project?
|

December 24th, 2011, 07:53 PM
|
Authorized User
|
|
Join Date: Nov 2011
Posts: 86
Thanks: 3
Thanked 5 Times in 5 Posts
|
|
Hi droidus
just going back to some previous posts, what code should i manually type out? i noticed that the code for the exercises is not in the book. do i just download the code, and manually write that out?
You should write out all the code, this is how you learn. Also Lee usually starts with one function and then adds to it. The code from the web site is just the final form. You will miss out if you don't do them in order. I use the the downloaded code to compare to my code when I have a problem.
Basically you should follow the instructions in the book, that's why you paid good money for it.
also, when running the downloaded programs, i am not sure how to run them. i use eclipse. i see the .classpath, .project, AndroidManifest.xml, etc., but not any of the other ones, such as layout.activity2, or any of the src files. is there a simple way to import the whole project?
If you do want to try the downloaded code you must copy everything in to the project you created for it. I have not figured how to import code as a project. If anyone knows, please tell me.
Cliff
__________________
"Software to the Stars"
Failure is not an option. It comes bundled with your Microsoft products.
|

December 25th, 2011, 08:40 PM
|
Authorized User
|
|
Join Date: Dec 2011
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
so basically you write the code yourself, and check it against what they have? i thought that they would have taught you from the bottom up how to build android applications.
|
|
 |
|