notepad tutorial problem with Input configuration changed

by thisnameagain » Sat, 13 Dec 2008 03:25:37 GMT


Sponsored Links
 When switching from portrait to landscape view when you are creating a
new note, i.e. revealing the keyboard, causes the application to
unexpectedly stop. Has anyone else had this problem? have you fixed
it?



--~--~---------~--~----~------------~-------~--~----~



notepad tutorial problem with Input configuration changed

by radiolistener » Wed, 17 Dec 2008 07:43:22 GMT


 Hi ThisNameAgain,

I don't have a G1 yet, so I can't say I've tried it.  But I've done a
lot with the Notepad example.  If you are on Exercise2, you may want
to forge ahead to exercise3 and see if that solves it.  With exercise
2 it is hobbled, in that it can not save state if it loses focus.
With exercise 3, it has the ability to save state, and is a much more
powerful application.

I have completed exercise1 and exercise2 in video representation on my
site and I am now doing the Ground work on exercise3.

That's my best advice I can give, hopefully it proves helpful.

Best of Luck,

John.
 http://radiolistenersElectricEasel.com 




--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. Error starting tools in 1.6 on Mac OS - SOLUTION

Hi,

I've been unable to run any of the tools in the Donut SDK, using Snow
Leopard - it seems to be due to the 64bit nature of the OS.

Followed the steps in the upgrade guide, but when it comes to starting
any of the tools (android, ddms etc), they refuse to start with the
error message:

"David-Horns-MacBook:tools David$ ./ddms
SWT folder '/Users/David/Desktop/Eclipse IDE/android-sdk-
mac_x86-1.6_r1/tools/lib/x86_64' does not exist.
Please export ANDROID_SWT to point to the folder containing swt.jar
for your platform."

There is no x86-64 folder, but I've come up with a bit of a bodge that
works.  Open the file in a handy text editor, and look for the lines:

# Combine the swtpath and the framework dir path.
if [ -d "$swtpath" ]; then
    frameworkdir="${swtpath}:${frameworkdir}"
else
    echo "SWT folder '${swtpath}' does not exist."
    echo "Please export ANDROID_SWT to point to the folder containing
swt.jar for your platform."
    exit 1
fi

Replace them with this, substituting your own path in to the lib
folder.

# Combine the swtpath and the framework dir path.
    frameworkdir="/Users/David/Desktop/Eclipse IDE/android-sdk-
mac_x86-1.6_r1/tools/lib/x86:${frameworkdir}"

Hope this helps (not sure if this is a problem unique to me, or
whether it's affecting everyone on Snow Leopard).

Dave.
--~--~---------~--~----~------------~-------~--~----~

2. Extending a view class

Hoi

I try to create my custom view inside a linearlayout. For example

<View  android:id="@+id/ViewPaint"
class="com.example.android.helloactivity.HelloActivity$DrawingView"/>

In the java source I created a DrawingView class which extends View.
Unfortunatly it does not get instantiated. I tried to overwrite the
ondraw() but without success :-(

Help is very much appreciated.
Jasper

Java Code
   public static class DrawingView extends View
    {
        private final Paint mPaint;
        /*
         * Constructor that is called when inflating a view from XML.
         */
        DrawingView(Context context, AttributeSet attrs){
                super(context,attrs);

            mPaint = new Paint();
            mPaint.setAntiAlias(true);
            mPaint.setARGB(255, 255, 255, 255);
        }

        @Override
        protected void onDraw(Canvas canvas) {
                float yPos;
                float xPos;
                int   xOffset = 20;
                int   yOffset = 50;
                int   cxScreen = canvas.getWidth();
                int   cyScreen = canvas.getHeight();
                int   cx = cxScreen - (2*xOffset);
                int   cy = cyScreen - (2*yOffset);
                int   cxStepSize = cx/10 - 1;
                int   cyStepSize = cy/10 - 1;

            // Makes the complete screen white!
            //canvas.drawColor(0xFFFFFFFF);
            yPos = (float)yOffset;
            xPos = (float)xOffset;
            for (int i=0; i <= 10; i++)
            {   // xstart, ystrt,xend,yend
                canvas.drawLine((float)xOffset, yPos, (float)cx, (float)
yPos, mPaint);
                yPos += cyStepSize;
            }
            for (int i=0; i <= 10; i++)
            {   // xstart, ystrt,xend,yend

                canvas.drawLine((float)xPos, (float)yOffset, (float)xPos,
(float)cy, mPaint);
                xPos += cxStepSize;
            }
        }
    }

XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="vertical"
    android:padding="10dip"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dip"
        android:text="Please select a planet:"
    />

    <Spinner
        android:id="@+id/spinner"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:drawSelectorOnTop="true"
        android:prompt="@string/planet_prompt"
    />
     <TextView android:id="@+id/dateDisplay"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="No date yet"/>

       <Button android:id="@+id/pickDate"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Change the date"/>

    <TextView android:id="@+id/timeDisplay"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="No time yet"/>

    <Button android:id="@+id/pickTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Verander the time"/>

<View  android:id="@+id/ViewPaint"
class="com.example.android.helloactivity.HelloActivity$DrawingView"/>
</LinearLayout>

--~--~---------~--~----~------------~-------~--~----~

3. Get the current assigned google account

4. Aplikasi lucu

5. Scroll image like a WebView

6. How to prematurely stop a long-running SQLite query?

7. The MultiBubbles Online tournament has started. Win prizes while playing MultiBubbles on your Android device!