Low performance using SurfaceView, touchMode and OptionMenu

by Jason Van Anden » Thu, 25 Jun 2009 01:47:06 GMT


Sponsored Links
 I highly recommend that you watch this:

 http://www.youtube.com/watch?v=U4Bk5rmIpic 

Jason Van Anden
 http://www.smileproject.com 

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



Other Threads

1. Resetting a HTTP InputStream...is this possible?

It would seem to me that a more logical approach would be to save the
stream when reading it then parse the data rather than re-read the
stream a second time. What if the second time there was an error? I'm
not positive how this works, it may be that the stream is cached so
you're not actually making a second http request by resetting it, but
then again, you may in which case it would be very wasteful to reset.

-John Coryat

"Radar Now!"

"What Zip Code?"

2. EditText.getText() not working

I am simple sudoku app. My main.xml has 81 EditText and 2 buttons as
shown below.

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@color/activity_background">
        <EditText
                android:id="@+id/text1"
                android:layout_width="33dip"
                android:layout_height="33dip"
                android:background="@color/textBox_background"
                android:layout_marginBottom="2dip"
                android:layout_marginRight="2dip"
                android:layout_marginLeft="2dip"
                android:maxLength="1"
                android:textColor="@color/textBox_color"
                android:numeric="integer"
                android:paddingLeft="11dip"
                android:selectAllOnFocus="true" />
        <EditText
                android:id="@+id/text2"
                android:layout_width="33dip"
                android:layout_height="33dip"
                android:background="@color/textBox_background"
                android:layout_marginBottom="2dip"
                android:layout_marginRight="2dip"
                android:maxLength="1"
                android:textColor="@color/textBox_color"
                android:numeric="integer"
                android:paddingLeft="11dip"
                android:layout_toRightOf="@id/text1"
                android:layout_alignTop="@id/text1"
                android:selectAllOnFocus="true" />
        <EditText
                android:id="@+id/text3"
                android:layout_width="33dip"
                android:layout_height="33dip"
                android:background="@color/textBox_background"
                android:layout_marginBottom="2dip"
                android:layout_marginRight="4dip"
                android:maxLength="1"
                android:textColor="@color/textBox_color"
                android:numeric="integer"
                android:paddingLeft="11dip"
                android:layout_toRightOf="@id/text2"
                android:layout_alignTop="@id/text1"
                android:selectAllOnFocus="true" />
        <EditText
                android:id="@+id/text4"
                android:layout_width="33dip"
                android:layout_height="33dip"
                android:background="@color/textBox_background"
                android:layout_marginBottom="2dip"
                android:layout_marginRight="2dip"
                android:maxLength="1"
                android:textColor="@color/textBox_color"
                android:numeric="integer"
                android:paddingLeft="11dip"
                android:layout_toRightOf="@id/text3"
                android:layout_alignTop="@id/text1"
                android:selectAllOnFocus="true" />
        <EditText
                android:id="@+id/text5"
                android:layout_width="33dip"
                android:layout_height="33dip"
                android:background="@color/textBox_background"
                android:layout_marginBottom="2dip"
                android:layout_marginRight="2dip"
                android:maxLength="1"
                android:textColor="@color/textBox_color"
                android:numeric="integer"
                android:paddingLeft="11dip"
                android:layout_toRightOf="@id/text4"
                android:layout_alignTop="@id/text1"
                android:selectAllOnFocus="true" />
        <EditText
                android:id="@+id/text6"
                android:layout_width="33dip"
                android:layout_height="33dip"
                android:background="@color/textBox_background"
                android:layout_marginBottom="2dip"
                android:layout_marginRight="4dip"
                android:maxLength="1"
                android:textColor="@color/textBox_color"
                android:numeric="integer"
                android:paddingLeft="11dip"
                android:layout_toRightOf="@id/text5"
                android:layout_alignTop="@id/text1"
                android:selectAllOnFocus="true" />
        <EditText
                android:id="@+id/text7"
                android:layout_width="33dip"
                android:layout_height="33dip"
                android:background="@color/textBox_background"
                android:layout_marginBottom="2dip"
                android:layout_marginRight="2dip"
                android:maxLength="1"
                android:textColor="@color/textBox_color"
                android:numeric="integer"
                android:paddingLeft="11dip"
                android:layout_toRightOf="@id/text6"
                android:layout_alignTop="@id/text1"
                android:selectAllOnFocus="true" />

....
....
....
....
....


        <EditText
                android:id="@+id/text80"
                android:layout_width="33dip"
                android:layout_height="33dip"
                android:background="@color/textBox_background"
                android:layout_marginBottom="2dip"
                android:layout_marginRight="2dip"
                android:maxLength="1"
                android:textColor="@color/textBox_color"
                android:numeric="integer"
                android:paddingLeft="11dip"
                android:layout_toRightOf="@id/text79"
                android:layout_alignTop="@id/text73"
                android:selectAllOnFocus="true" />
        <EditText
                android:id="@+id/text81"
                android:layout_width="33dip"
                android:layout_height="33dip"
                android:background="@color/textBox_background"
                android:layout_marginBottom="2dip"
                android:maxLength="1"
                android:textColor="@color/textBox_color"
                android:numeric="integer"
                android:paddingLeft="11dip"
                android:layout_toRightOf="@id/text80"
                android:layout_alignTop="@id/text73"
                android:selectAllOnFocus="true" />
        <Button
                android:id="@+id/solveButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_below="@id/text73"
                android:layout_alignParentRight="true"
                android:layout_marginTop="10dip"
                android:text="Solve" />
        <Button
                android:id="@+id/resetButton"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toLeftOf="@id/solveButton"
                android:layout_alignTop="@id/solveButton"
                android:text="Reset" />
</RelativeLayout>

In my activity class, I have grouped all these 81 EditTexts into one 2-
dimensional array as shown below.

EditText[][] textArray = new EditText[9][9];

textArray[0][0] = (EditText)findViewById(R.id.text1);
textArray[0][1] = (EditText)findViewById(R.id.text2);
textArray[0][2] = (EditText)findViewById(R.id.text3);
textArray[0][3] = (EditText)findViewById(R.id.text4);
textArray[0][4] = (EditText)findViewById(R.id.text5);
textArray[0][5] = (EditText)findViewById(R.id.text6);
textArray[0][6] = (EditText)findViewById(R.id.text7);
textArray[0][7] = (EditText)findViewById(R.id.text8);
textArray[0][8] = (EditText)findViewById(R.id.text9);
textArray[1][0] = (EditText)findViewById(R.id.text10);
textArray[1][1] = (EditText)findViewById(R.id.text11);
textArray[1][2] = (EditText)findViewById(R.id.text12);
textArray[1][3] = (EditText)findViewById(R.id.text13);

...
...
...

textArray[8][8] = (EditText)findViewById(R.id.text81);


Now when I try to do a simple getText() method on textArray[][], it
gives me a runtime error but setText() method works fine on textArray[]
[]

textArray[i][j].getText().toString()


Please help me find out what I am doing wrong or what I need to
change. Thank you in advance.

3. One service to rule them all

4. Wired+Wireless Tether apk

5. Resetting a HTTP InputStream...is this possible?

6. Androids on a new Cell Network

7. OOT: Mirdak di Puri Mall