Wrox Programmer Forums
|
BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2
This is the forum to discuss the Wrox book Professional Android Application Development by Reto Meier; ISBN: 9780470344712
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 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
 
Old November 30th, 2008, 01:29 AM
Registered User
 
Join Date: Nov 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default I am finding the book a bit over my head

I have an issue with the basic structure that I can't seem to get past. I am using Eclipse and trying to run through the examples in chapter 4. Here is my issue:

I have a project i setup in Eclipse. Under it have have the usual default setup. I compile and run the default code just fine. When I try to edit the TodoListItemView source file I get an error in the AndroidManifest.xml file in the project root. Here is that file and the <X> in the code below is the issue. The error message is "TDLIV.com.TodoListItemView does not extend android.app.Activity"

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="(deleted the http)schemas.android.com/apk/res/android"
      package="TDLIV.com"
      android:versionCode="1"
      android:versionName="1.0.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
        <activity android:name=".TodoListItemView"
<X> android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

So far, I am trying to do step #1 on page 83. That code is as follows and shows no errors.
--------------------------
package TDLIV.com;

import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.widget.TextView;
import android.app.Activity;
import android.os.Bundle;

public class TodoListItemView extends TextView {

      /** Constructors. Each should call init() */
      public TodoListItemView (Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        init();
      }

      public TodoListItemView (Context context) {
        super(context);
        init();
      }

      public TodoListItemView (Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
      }

      private void init() {
      }

}
_______________________

I am obviously a novice and would really appreciate anyones comments greatly. I used to do some java coding for fun but was not using Eclipse.

Thanks in advance for any help.

Fred
 
Old November 30th, 2008, 01:07 PM
Reto's Avatar
Wrox Author
 
Join Date: Oct 2008
Posts: 61
Thanks: 1
Thanked 7 Times in 6 Posts
Default

  It looks like the error your seeing in the Chapter 4 example is because the class you've created in step 1 (TodoListItemView) is not an Activity, so you can't put it directly into the Manifest as you've done. It needs to be referenced by a Layout that's in turn used by an ArrayAdapter within an Activity -- that's what's shown in steps 5 and 6.

  What might have caused the confusion is that the example you're looking at in Chapter 4 builds on an earlier example -- the To-do List example in Chapter 2 (page 37). To do the steps in the Chapter 4 example you need to have created that earlier TodoList Activity. The example in Chapter 4 lets you change the appearance of each of the to-do list Items shown in the ListView.

  From the looks of things, I'd say you can probably skip straight to step 5 on page 39 of the Chapter 2 example. Steps 5 through 8 show how to create the Activity layout and the Activity class that you need for Chapter 4. Alternatively, if you want to skip Chapter 2 entirely, you can download the source code for it from here:

http://www.wrox.com/WileyCDA/WroxTit...-DOWNLOAD.html

...and jump straight into the Chapter 4 example.

Let me know how you get on, hopefully I'll be able to help.

Cheers
Reto

--
Author, Professional Android Application Development
 
Old November 30th, 2008, 02:40 PM
Registered User
 
Join Date: Nov 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the help. Of course, I see that now. I'll move on and give it another try.






Similar Threads
Thread Thread Starter Forum Replies Last Post
64 Bit - Issue in 64 bit IIS calling Win32 API Hubman General .NET 1 August 24th, 2006 09:19 AM
Finding the DB Sailor.mdb of Beginning ASP DB book anna Classic ASP Databases 2 August 5th, 2006 01:13 PM
I am so in over my head AnnMarie Dreamweaver (all versions) 1 May 19th, 2005 02:19 PM
Can't get my head around - help. Mantis MySQL 2 February 23rd, 2005 12:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.