Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Beginning Android Application Development
Password Reminder
Register
| 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 31st, 2011, 04:35 PM
Authorized User
Points: 44, Level: 1
Points: 44, Level: 1 Points: 44, Level: 1 Points: 44, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default First chapter of Beginning Android

Needless to say I had installed JDK 7.0 Eclipse Helios and Android SDK
and then added ADT plug in to Eclipse.

Currently My SDK manager shows only 3.0 Platforms and higher and also just 2.3.3 Addon although I had checked all packages 46 of them prior to installation.

when I tried to create virtual device on 2.3 Platform for me to work with the first sample with this book. After click AVD button to create new device, it was not able to list the 2.3 platform in Target list after naming the emulator.

So I started all over again creating c://Android folder followed the book's step by step from developer.android.com/sdk/index.html. Then they are now installed and unzipped to new Android folder. Then I opened eclipse.
click help>install new software. in install window i type
http://dl-ssl.google.com/android.eclipse in text box

the developer tools items did not display until i corrected http:// to https://.
Then developer tools items displayed correctly.

After checking all items to install, but dialog said all have been added. Apparently shows that Eclipse still goes to same old directory. How can I redirect it to new folder c:\android that I just installed and unzipped there.


Eclipse still directs to same, old SDK path C://Alan/downloads/Android-SDKr16..... from previous installation a few days ago.



Another thing I noticed in developer tools items it showed version 16.0. and higher while in book it showed 8.0.1

Alan with little hope
Reply With Quote
  #2 (permalink)  
Old December 31st, 2011, 07:50 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 Alan
I am not totally sure I understand your problem, but try this:
In Eclipse Click the 'Window' menu ( far right on the top line).
Click the 'Preferences' item (bottom of the list).
This will open a page with a list on the left and data on the right.
The second item in the list is 'Android', click this.
The right side should show the path to find the android-sdk. I think this is what you are looking for. Below that is a list of what that path contains, I think.
Hope this helps
Cliff
__________________
"Software to the Stars"
Failure is not an option. It comes bundled with your Microsoft products.
Reply With Quote
  #3 (permalink)  
Old December 31st, 2011, 08:03 PM
Authorized User
Points: 44, Level: 1
Points: 44, Level: 1 Points: 44, Level: 1 Points: 44, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Cliff,


After follwing your instructions,

It says the existing SDK Location:

C:\Users\Alan\Android-sdks



On same Android page where SDK location is, it lists

Target names i.e
Android Platform 3.0
Google APIs 3.0
3.1
3.1
3.2
3.2
4.0
4.0
4.0.3
4.0.3

I would have used this same SDK path if it contains more missing platforms like 2.3 platform and so forth.

Tht is why I want to start again at c:\android.

Can I browse it and change to this new SDK path?
Reply With Quote
  #4 (permalink)  
Old December 31st, 2011, 08:35 PM
Authorized User
Points: 44, Level: 1
Points: 44, Level: 1 Points: 44, Level: 1 Points: 44, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Now I understand what went wrong.

I realized that I had not installed 2.3.3 and lower platforms i.e 2.2 etc to 1.5. I thought I did! After adding these components (2..3 through 1.5) Now the SDK manager says they are there now.

And it becomes clear now that 2.3 API 9 platform is no longer exist (obselete) that I need to work out the book sample.
I guess I can choose 2.3.3 API 10 Level as an alternative to the missing 2.3 API 9 platform. I will check out.

Tomorrow is Happy New Year. I will resume on Monday.

Last edited by alan4100; December 31st, 2011 at 11:28 PM..
Reply With Quote
  #5 (permalink)  
Old December 31st, 2011, 09:40 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 Alan
Well there is a 'browse' button next to the path, try it.
Once you get the path correct. Use the 'Android SDK Manger' to add any packages you need. It shows the path at the top but you can't change it there. It is the left of the two green android robot buttons under the menus in eclipse.

There is no reason that you can not use any of the API levels to do the lessons in the book. Now maybe some of the code might not work on some of the early APIs, but I think that most of should run on all (but I'm new at this too so take this with a grain of salt).
As I have said in some previous post, if you want to learn you need to type the code in, as the book suggest. I use the down loadable code as a check when something does not work. The code you can download is the final product and most of the time it has been built up form several layers. These layers show you how to do different things. I know its a pain but type the code in and follow the book, if you want to learn something.
When you start a project is will ask you to select the API level you want to build to, but of course that level must be in the path.
If you really must use the download code you cane change the Api level using the 'project' menu button and select 'properties', then android and select the level you want.

If you are just stating, read the appendixes in the back of the book first. They tell you about Eclipse and the emulator and how to use them.

Hope this is some use
Cliff
__________________
"Software to the Stars"
Failure is not an option. It comes bundled with your Microsoft products.
Reply With Quote
  #6 (permalink)  
Old January 1st, 2012, 04:18 AM
Authorized User
Points: 44, Level: 1
Points: 44, Level: 1 Points: 44, Level: 1 Points: 44, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

after running new project: HelloWorld

Then got two hardcoded warning error items in HelloWorld/Res/Lay line 10 and 14 at the bottom of Eclipse:Problem Tab.


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
< error here> android:text="this is my first 2012 application,hello" />
<Button
android:layout_width="fill_parent"
android:height_height="wrap_content"
< error here> android:text="this is my first 2012 clickable button!!"

</LinearLayout>

these color red: what are typo errors?

Last edited by alan4100; January 1st, 2012 at 12:45 PM..
Reply With Quote
  #7 (permalink)  
Old January 1st, 2012, 08:23 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 Alan
The code from main.xml look good to me, less the red text. I copied the TexView into one of my main.xml files (less the red text) and it worked fine.
Is there an main.xml.out file? If there is, delete it. If you hit F11 or the run button and the focus is in main.xml it will create the .out file and not work. Always click on the java file or the project name before you hit run(F11). It will not run if there is an main.xml.out file, be sure that you delete if it is there. Note: sometimes it will not let you delete this file. Wait a while and try again. If all else fails, quit Eclipse and restart it, then you be able to delete it. If this is not the problem tell us what the error message says.
Typo errors are miss typed items. Like "ancroid" for android.

I got an email with different questions. I don't know why it is not posted here.
As I said I don't thin it matters which API you use, I have used 2.3.3 for all the code so far. Well once I missed when I clicked on it and used 4.0.

Another thing I have not yet downloaded codefile helloworld.zip available at wrox.site. I believe the package name: net.learn2develop.HelloWorld
has its own code. so both are separate issues. I mean two separate projects.

The down loadable code is for reference. I am not sure what you are trying to say, but I believe that each project in eclipse must have different project names.
Cliff
__________________
"Software to the Stars"
Failure is not an option. It comes bundled with your Microsoft products.
Reply With Quote
  #8 (permalink)  
Old January 2nd, 2012, 06:34 PM
Authorized User
Points: 44, Level: 1
Points: 44, Level: 1 Points: 44, Level: 1 Points: 44, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Cliff,

I am in a bit hurry to answer your email because I dont want to keep you waiting so long or drive me crazy.

I started all over again .ie. deleting workspace and those hellowoworld projects.
This time it is all clean and made a new project. It then progressed and launched virtual 2.3.3 device with no errors. Unbelievable, but I cheated a bit. This time I did not add/modify to main.xml at all. That is why it went through fine. After little experimentation, I think I know what went wrong. I was not supposed to edit main.xml at all. This way I botched the project. I then edited strings.xml, instead. It seemed that it was supposed to be that way so that main.xml reads what is in strings.xml with @string identifier.

I am still not sure because Wei's book said I was supposed to add new lines to main.xml. I have to read and reread the book (Wei's).
It may become clear later.

Hi Alan
The code from main.xml look good to me, less the red text. I copied the TexView into one of my main.xml files (less the red text) and it worked fine.
Is there an main.xml.out file? If there is, delete it. If you hit F11 or the run button and the focus is in main.xml it will create the .out file and not work. Always click on the java file or the project name before you hit run(F11). It will not run if there is an main.xml.out file, be sure that you delete if it is there. Note: sometimes it will not let you delete this file. Wait a while and try again. If all else fails, quit Eclipse and restart it, then you be able to delete it. If this is not the problem tell us what the error message says.
Typo errors are miss typed items. Like "ancroid" for android.

I got an email with different questions. I don't know why it is not posted here.

It was posted and deleted a few times. It was not due to magic wonders. It disappeared with the click of Edit. I did that a few times; too many it is because I was asking too many questions at a time.

As I said I don't thin it matters which API you use, I have used 2.3.3 for all the code so far. Well once I missed when I clicked on it and used 4.0.

Another thing I have not yet downloaded codefile helloworld.zip available at wrox.site. I believe the package name: net.learn2develop.HelloWorld
has its own code. so both are separate issues. I mean two separate projects.
The down loadable code is for reference. I am not sure what you are trying to say, but I believe that each project in eclipse must have different project names.

codefile helloworld.zip and package \. Wei's book wanted me to try out his package, not the codeflie zip. I need to focus on package: net.learn2develop.HelloWorld first for now.

Actually codefile helloworld.zip was supposed to be installed and unzipped to my designated directory then launch Eclipse to import that codefile into it as a new project with different name other than the package project. But you just said it can be used as a reference. Your may be right. But I still think thae hardcoded zip file can be imported to Eclipse, but I dont know how to do it.

Anyway, after toying with virtual display emulator after run helloproject today that progressed with no errors. It took me a while to find out Helloworld text on virtual device display. It was not there the first time. Accidently I hit wrong button Menu and showed this helloWorld display. I have to do some experimenting with the emulator.



Alan
Cliff
Yesterday 03:18 AM
Reply With Quote
  #9 (permalink)  
Old January 2nd, 2012, 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 Alan
About the extra email stuff, I thought it was something like that. How did you delete a post? I have not found a way to do that, edit it but not delete it.

Putting a set of code in eclipse has me stumped too.

Lee has the code for each completed project which you can download, but gives you the instructions to build it in the book. again I recommend that you follow the book and build the code one line at a time.

Note: Them emulator takes a long (very long) time to come up. Once it is up don't kill it. When you try to run the next time it will use the emulator that is running.
On the XML stuff. You can edit the XML file. You can use "sting" in it, but using the @Strings is a way that you can change the stings for different languages. You can have a @strings-ENG, @strings-others. Then all the text can be swapped by setting the language/location setting.
Cliff
__________________
"Software to the Stars"
Failure is not an option. It comes bundled with your Microsoft products.
Reply With Quote
  #10 (permalink)  
Old January 2nd, 2012, 11:37 PM
Authorized User
Points: 44, Level: 1
Points: 44, Level: 1 Points: 44, Level: 1 Points: 44, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2011
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

All I did was treating it like a notepad or wordpad document. I went back to earlier email that I wrote and click <EDIT> and do whatever I want. I can add or delete lines or correct words. Anthing then saved it again.

You can do that with your emails provided it was yours and edit as many times as you want. You cannot edit others.

I cannot delete a post. It was the same post I edited a few times.

Only androids can solve application problems without knowing how to edit.

Alan
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
Android SDK/Android.bat does not find SWT.jar file chaoticandroid BOOK: Professional Android 2 Application Development 1 March 23rd, 2011 06:39 PM
Chapter 11 code listing for Professonal Android 2 Application Development robertkji BOOK: Professional Android 2 Application Development 1 November 26th, 2010 09:45 AM
Chapter# 2 - Page 23 what to key in the new Android Project Ahmed75 BOOK: Professional Android 2 Application Development 7 August 29th, 2010 12:19 AM
Beginning PHP4 Chapter 8 sipb2002 Wrox Book Feedback 1 July 12th, 2003 12:12 AM



All times are GMT -4. The time now is 03:14 PM.


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