Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 21st, 2011, 06:58 PM
Authorized User
Points: 67, Level: 1
Points: 67, Level: 1 Points: 67, Level: 1 Points: 67, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Default 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
#
Reply With Quote
  #2 (permalink)  
Old December 21st, 2011, 09:08 PM
Authorized User
Points: 343, Level: 6
Points: 343, Level: 6 Points: 343, Level: 6 Points: 343, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 86
Thanks: 3
Thanked 5 Times in 5 Posts
Default

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.
Reply With Quote
  #3 (permalink)  
Old December 22nd, 2011, 01:51 PM
Authorized User
Points: 67, Level: 1
Points: 67, Level: 1 Points: 67, Level: 1 Points: 67, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Default

http://www.mediafire.com/?w1zchor9rebs175
http://www.mediafire.com/?f0a59f4pqlcf99u
http://www.mediafire.com/?ppqc6uhb3k4kps6
Reply With Quote
  #4 (permalink)  
Old December 22nd, 2011, 09:09 PM
Authorized User
Points: 343, Level: 6
Points: 343, Level: 6 Points: 343, Level: 6 Points: 343, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 86
Thanks: 3
Thanked 5 Times in 5 Posts
Default

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.
Reply With Quote
  #5 (permalink)  
Old December 22nd, 2011, 09:24 PM
Authorized User
Points: 343, Level: 6
Points: 343, Level: 6 Points: 343, Level: 6 Points: 343, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 86
Thanks: 3
Thanked 5 Times in 5 Posts
Smile 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.
Reply With Quote
  #6 (permalink)  
Old December 23rd, 2011, 12:16 PM
Authorized User
Points: 67, Level: 1
Points: 67, Level: 1 Points: 67, Level: 1 Points: 67, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Default

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..
Reply With Quote
  #7 (permalink)  
Old December 23rd, 2011, 07:54 PM
Authorized User
Points: 343, Level: 6
Points: 343, Level: 6 Points: 343, Level: 6 Points: 343, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 86
Thanks: 3
Thanked 5 Times in 5 Posts
Default

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.
Reply With Quote
  #8 (permalink)  
Old December 24th, 2011, 01:12 PM
Authorized User
Points: 67, Level: 1
Points: 67, Level: 1 Points: 67, Level: 1 Points: 67, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Default

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?
Reply With Quote
  #9 (permalink)  
Old December 24th, 2011, 07:53 PM
Authorized User
Points: 343, Level: 6
Points: 343, Level: 6 Points: 343, Level: 6 Points: 343, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2011
Posts: 86
Thanks: 3
Thanked 5 Times in 5 Posts
Default

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.
Reply With Quote
  #10 (permalink)  
Old December 25th, 2011, 08:40 PM
Authorized User
Points: 67, Level: 1
Points: 67, Level: 1 Points: 67, Level: 1 Points: 67, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 14
Thanks: 2
Thanked 0 Times in 0 Posts
Default

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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to start activity by service? liuhero2 BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 0 February 26th, 2009 01:30 AM
bug in activity tracking vantoko BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 February 25th, 2007 11:29 AM
capturing activity ozPATT Access VBA 2 December 21st, 2005 09:20 AM
Activity schedule edubbelaar Access 3 November 24th, 2004 11:21 AM
Error 1222 - When accessing Client activity ryant SQL Server 2000 1 March 16th, 2004 08:25 AM



All times are GMT -4. The time now is 02:36 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.