p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 (http://p2p.wrox.com/forumdisplay.php?f=432)
-   -   Serious Issues (http://p2p.wrox.com/showthread.php?t=77287)

silverx10 December 4th, 2009 05:49 AM

Serious Issues
So this book was published this year, and it already seems to be horribly out of date, which means it's prolly gonna get returned to Amazon.

That being said, just about every code snippet I've seen from the beginning of the book (the viewing of the Hello, World application) all the way to the chapter two To Do example are being swamped with errors.


public void onCreate(Bundle icicle) {
Is the first line that's given me grief. In the generated project file, it's actually generated as:


public void onCreate(Bundle savedInstanceState) {
Am I doing something horribly wrong, or is this book (as I've already decided) horribly out of date?

Reto December 4th, 2009 06:05 AM

There's certainly been a few changes since the release, but the code from the first 6 chapters should still work pretty well.

The problem you've indicated here is just a change in variable name. As you can see, the method signature is still the same:


public void onCreate(Bundle)
But the name of the bundle parameter is different. If you're seeing errors it's likely because the generated code now names the Bundle parameter savedInstanceSate, whereas in the code snippets I've used the name icicle. If you change them to make sure it's always the same name your errors should disappear.

If there are still any errors, let me know and I'll try and figure out what's going wrong.

Incidentally, the book was actually published a little over a year ago -- though it's still incredible how quickly things change!


silverx10 December 4th, 2009 06:13 AM

Good lord, that was a faster response than I was expecting.

I'm an insomniac, what's your excuse? ;)

Anyway, I'm gonna give this another go, and see if I can't get the example working by following each step verbatim.

In an attempt to cover all my bases, I even went so far as to downgrade from the Galileo release of Eclipse to Ganymede, as the book specifies.

Also, something that differs big time from your step-by-steps in the guides here is that your "New Project" windows don't look remotely similar to the one I'm using. It gives us an extra option: MinSDK Version.

Not sure if that makes a big difference, but all the same... here goes.

silverx10 December 4th, 2009 06:34 AM

Yep, did everything exactly as written, still getting tons of errors.

I've got some Visual Basic under my belt, but nothing that could lead me to intuitively figure out how to get around these issues. And with at least a little programming background, if I can't figure it out, I'm sure that nobody with an equivalent amount will be able to, either.

If I sound ungrateful, I apologize. Getting feedback from the author at all is more than I was expecting.


More specifically, this is what Eclipse has to say on each of those items:


Reto December 4th, 2009 06:48 AM

I live in England -- not bad as excuses go :)

First off, if you haven't already - let me suggest you download the code from:

If you've done that, you'll need to make a couple of changes before it will compile.
1) Open the project properties (right click the project, select 'Properties').
2) Select 'Android' on the right panel.
3) Select a build target (pick the last item on the list).

If you're developing using the emulator you'll also need to construct a new Android Virtual Device before you can debug your app.

silverx10 December 4th, 2009 06:55 AM

Aye, England is a good excuse as any, haha.


's what I see when I right-click > Properties on the project.

If I choose the last item in that list, the project generates a new warning that I've made a change, but that the API is set higher than that of the project.

Already configured an AVD when I checked out the Android SDK Hello, World example.

ScottYelich December 15th, 2009 02:18 PM

me too :-)
Ya, me too. :-/

I did some android before and I wanted to try to jump start to get to the next level -- so I bought this book. I had 1.5 and 1.6 -- and, of course, 2.0 comes out so I want to get up to date and dl it -- and then start the book. Now the code examples are riddled with out of date items -- screens, layouts and options are significantly changed. It's so bad, it's almost tempting to downgrade... but then I'll be getting familiar with old info.

I've managed to bang my head through all the issues I've had so far, and, in doing so, learn the changes and what to look for in the new versions, etc. However, even with that, the code and layout in the book -- TO ME -- seems extremely fragmented and totally random.

I'm now trying to add the menus to the todo projects. I've got the java code in, but where does the drawable resource xml go? I don't have just one drawable, it looks like I have low, medium and high... I have the X and + drawables in the ldpi -- but there doesn't seem to be any xml associated with it. I assume I'll have to make a drawable under values. YET -- the code in the book seems to assume that this should already be working
at this point. I went back to chapter 2 to see if I missed some XML editing there -- but I can't seem to find anything. I've gone over chapter 4 and I can't seem to find any XML etc. Fine, I'll take a few guesses, and then try a few searches, etc. (back now) -- seems that R.java gets (auto) generated, so I can look in the gen/r.Java and see what the system THINKS in there. I see the name of my lpdi image, so I changed the name in the code to match what the R gen has... now it seems to work.

Page 101 -- "For Example" ... "creatively labeled /Submenu/ from Figure 4-5, its" ... I don't have anything that says "Submenu" in figure 4-5. 4-5 says: menu item 5, 6, 9, checkbox, radiobutton 1, 2, 3 (Menu+a) ... etc.

It's all very confusing.

I downloaded the code. I've whacked the R.java ... but the code for chapter 4 doesn't have menus in it. *ARGH*


atulbharadwaj December 15th, 2009 03:02 PM

calculate resultset of two sql statement
There is a situation where I need to calcuated two data within the stored procedure. And the sum of these two data should

return from stored procedure.Right now I am not concentrating on return value.

My problem is that I need the values return through the two select statement within @v1 and @v2, but when i execute this

procedure it returns me the select statement (string) within these variable. Please suggest me the appropriate way to do this.
I will appriciate any response. it will help me to go further into my solution.

ALTER PROCEDURE [dbo].[WeightageInASI]
@Quarter varchar(10),
@Sector varchar(100),
@CurrentYear varchar(10)
DECLARE @Weightagevalue float
DECLARE @v1 float, @v2 float, @v3 float

select @v1 = 'SELECT isnull(sum(Q.'+ @Quarter +'),0) as '+ @Quarter +' FROM CompanyClassification c INNER JOIN
QuarterlyCapitalisation Q ON C.BSC_CODE=Q.BSC_CODE WHERE
C.SECTOR = ' + Char(39) + +' ' + @Sector + Char(39) +' AND Q.'+ @Quarter +' !=0 AND YEAR= '+ Char(39) + @CurrentYear +

Char(39) +''

select @v2 = 'SELECT isnull(sum(Q.'+ @Quarter +'),0) as '+ @Quarter +' FROM CompanyClassification c INNER JOIN
QuarterlyCapitalisation Q ON C.BSC_CODE=Q.BSC_CODE WHERE
C.SECTOR = ' + Char(39) + 'Not In ASI' + Char(39) +' AND Q.'+ @Quarter +' !=0 AND YEAR= '+ Char(39) + @CurrentYear + Char(39)

exec @v2
set @v3 = @v1 * 100 / @v2


ScottYelich December 15th, 2009 03:05 PM

interesting java
Which chapter is that code from? :-)

louisx January 13th, 2010 02:35 PM

Some suggestions for the 2.0 book
While this book has helped me to some extent, I'm fairly disappointed in the lack of detail. For one, I just purchased it and was not aware that it was only Android 1.0. This should be stated more clearly. Wrox should offer an upgrade special to the Android 2.0 book. Second, I've used many Wrox books and what I like about them is that code is shown, and then a full step by step explanation of what is going on in the code follows. This Android book only has very brief explanations of what is going on in the code, leaving out necessary detail. And the way it illustrates things like animation before even showing the basics makes it very confusing to step through methodically. Also, an Appendix with some key class descriptions and some basic Eclipse configuration info would be useful. I've had a lot of programming experience, so I've been able to work through some of the issues, but I pity those who do not have experience.

All times are GMT -4. The time now is 06:05 AM.

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