Stop Surface View being destroyed

by Adrian Hirst » Fri, 19 Feb 2010 02:19:05 GMT


Sponsored Links
 Hi,

I have created a game that uses SurfaceView and need input for player
to enter there name so I created a View xml that allows the player to
enter there name with the virtual keyboard.

The problem I have is when I call setContentView(nameView) it destroys
the surfaceview and everything associated with it is there away to
preserve the SurfaceView as it gets rid of all the gfx that have been
loaded.

Thanks

Adrian

--



Stop Surface View being destroyed

by Steeler » Fri, 19 Feb 2010 14:13:10 GMT


 One thing that comes to mind is using an AlertDialog for the name
prompt instead of a View.




--


Sponsored Links


Other Threads

1. Google G1 for developers Shipping cost $170!? is this a joke?

Hello

I was trying to purchase the G1 unlocked for developers this morning
for $399 and when i got to the shipping charge it said $170+ which i
think to the UK is outrageous! Is this a misprint or is it really that
stupid a price!?

Please help as this is stopping me getting the unlocked G1.

Regards

Sparklehedgehog

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

2. IOException in HttpClient: unknown error while trying to access run simple MAP application

Hi
I am trying to run a simple MAP application.The source code is as
below:

package test.test;

import android.os.Bundle;
import android.view.KeyEvent;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;

public class testapp extends MapActivity
{
    private MapView myMapView;

    @Override
    protected boolean isRouteDisplayed()
    {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public void onCreate(Bundle icicle)
    {
        super.onCreate(icicle);
        myMapView = new MapView(this, "");

        // Lets start at the Statue of Liberty
        // I grabbed the data from Google-Maps
        GeoPoint p = new GeoPoint((int) (40.689213 * 1000000), (int)
(-74.044558 * 1000000));
        // Get the controller, that is used for translation and
zooming
        MapController mc = myMapView.getController();
        // Translate to the Statue of Liberty
        mc.animateTo(p);
        // Zoom Very close
        // mc..zoomTo(21);
        // Make myMapView the exilicit view of this app
        setContentView(myMapView);
        // Enable Sattelite-Mode, so we will se the
        // Statue of liberty instantly on the screen
        myMapView.setSatellite(true);
    }

    public boolean onKeyDown(int keyCode, KeyEvent event)
    {
        if (keyCode == KeyEvent.KEYCODE_I)
        {
            // Zooming In
            // myMapView.getController().zoomTo(myMapView.getZoomLevel
() + 1);
            return true;
        }
        else
            if (keyCode == KeyEvent.KEYCODE_O)
            {
                // Zooming Out
                // myMapView.getController().zoomTo
(myMapView.getZoomLevel() -
                // 1);
                return true;
            }
            else
                if (keyCode == KeyEvent.KEYCODE_S)
                {
                    // Switch to satellite view
                    myMapView.setSatellite(true);
                    return true;
                }
                else
                    if (keyCode == KeyEvent.KEYCODE_T)
                    {
                        // Switch on traffic overlays
                        myMapView.setTraffic(true);
                        return true;
                    }
        return false;
    }

}


The application runs and a blank map screen is displayed.
The logcat output is
E/OSNetworkSystem(15783): unknown socket error -1
W/AndroidHttpConnectionFactory(15783): IOException in HttpClient:
unknown error
D/dalvikvm(   57): GC freed 7089 objects / 342672 bytes in 243ms
E/OSNetworkSystem(15783): unknown socket error -1
W/AndroidHttpConnectionFactory(15783): IOException in HttpClient:
unknown error
E/OSNetworkSystem(15783): unknown socket error -1
W/AndroidHttpConnectionFactory(15783): IOException in HttpClient:
unknown error
E/OSNetworkSystem(15783): unknown socket error -1
W/AndroidHttpConnectionFactory(15783): IOException in HttpClient:
unknown error
E/OSNetworkSystem(15783): unknown socket error -1
W/AndroidHttpConnectionFactory(15783): IOException in HttpClient:
unknown error
E/OSNetworkSystem(15783): unknown socket error -1
W/AndroidHttpConnectionFactory(15783): IOException in HttpClient:
unknown error
E/OSNetworkSystem(15783): unknown socket error -1
W/AndroidHttpConnectionFactory(15783): IOException in HttpClient:
unknown error
E/OSNetworkSystem(15783): unknown socket error -1
W/AndroidHttpConnectionFactory(15783): IOException in HttpClient:
unknown error
E/OSNetworkSystem(15783): unknown socket error -1
W/AndroidHttpConnectionFactory(15783): IOException in HttpClient:
unknown error
E/OSNetworkSystem(15783): unknown socket error -1
W/AndroidHttpConnectionFactory(15783): IOException in HttpClient:
unknown error
D/dalvikvm(15783): GC freed 10468 objects / 533944 bytes in 316ms
E/OSNetworkSystem(15783): unknown socket error -1
W/AndroidHttpConnectionFactory(15783): IOException in HttpClient:
unknown error
E/OSNetworkSystem(15783): unknown socket error -1
W/AndroidHttpConnectionFactory(15783): IOException in HttpClient:
unknown error
E/OSNetworkSystem(15783): unknown socket error -1
W/AndroidHttpConnectionFactory(15783): IOException in HttpClient:
unknown error

.
I am sitting behind a proxy and have already set the proxy in the
settings db.

Kindly provide help and inputs on the issue.

Thanks
Ajit

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

3. Can some please create this?

4. SQLite, android_metadata

5. Can we have PACKAGE_ADDED and CHANGED back?

6. Make it easier to add to contacts

7. Street View integration needs some work