Error trying to use XML Layout and extended GLSurfaceView

by Jeremiah Sellars » Thu, 06 May 2010 03:11:17 GMT


Sponsored Links
  won't beat around the bush here... I'm trying to put my
GLSurfaceView (called ShapeSurfaceView) into a relative layout. Before
trying to use a layout, everything has been working fine simply
instantiating the view and calling setContentView(mShapeSurfaceView).
Since I got this error I researched how to create the layout
completing in the Java and that is working quite nicely... it's just a
ton of code to setup the layout, view and rules for the view. I'd
really rather have the XML method working.

Here's the main XML, I've added no other views yet:

<?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="fill_parent"
>
<com.maximusdev.tests3d.ShapeSurfaceView
android:id="@+id/glview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</RelativeLayout>

The java from onCreate, nothing special...

setContentView(R.layout.main);
mShapeSurfaceView = (ShapeSurfaceView)findViewById(R.id.glview);

Here is the logcat error. My previous logcat error was mentioning the
class constructor missing the AttributeSet parameter so I added that
to the constructor for the ShapeSurfaceView yet still ended up with
this.

05-05 18:22:40.327: ERROR/AndroidRuntime(294): Uncaught handler:
thread main exiting due to uncaught exception
05-05 18:22:40.337: ERROR/AndroidRuntime(294):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.maximusdev.tests3d/com.maximusdev.tests3d.My3DTest}:
java.lang.NullPointerException
05-05 18:22:40.337: ERROR/AndroidRuntime(294): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2401)
05-05 18:22:40.337: ERROR/AndroidRuntime(294): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
2417)
05-05 18:22:40.337: ERROR/AndroidRuntime(294): at
android.app.ActivityThread.access$2100(ActivityThread.java:116)
05-05 18:22:40.337: ERROR/AndroidRuntime(294): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
05-05 18:22:40.337: ERROR/AndroidRuntime(294): at
android.os.Handler.dispatchMessage(Handler.java:99)
05-05 18:22:40.337: ERROR/AndroidRuntime(294): at
android.os.Looper.loop(Looper.java:123)
05-05 18:22:40.337: ERROR/AndroidRuntime(294): at
android.app.ActivityThread.main(ActivityThread.java:4203)
05-05 18:22:40.337: ERROR/AndroidRuntime(294): at
java.lang.reflect.Method.invokeNative(Native Method)
05-05 18:22:40.337: ERROR/AndroidRuntime(294): at
java.lang.reflect.Method.invoke(Method.java:521)
05-05 18:22:40.337: ERROR/AndroidRuntime(294): at
com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:791)
05-05 18:22:40.337: ERROR/AndroidRuntime(294): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
05-05 18:22:40.337: ERROR/AndroidRuntime(294): at
dalvik.system.NativeStart.main(Native Method)
05-05 18:22:40.337: ERROR/AndroidRuntime(294): Caused by:
java.lang.NullPointerException
05-05 18:22:40.337: ERROR/AndroidRuntime(294): at
com.maximusdev.tests3d.My3DTest.onCreate(My3DTest.java:30)
05-05 18:22:40.337: ERROR/AndroidRuntime(294): at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1123)
05-05 18:22:4



Error trying to use XML Layout and extended GLSurfaceView

by Jeremiah Sellars » Thu, 06 May 2010 04:23:35 GMT


 ot this in the Eclipse console the next time I opened it, searching
for the top error isn't getting me very far...

[2010-05-05 13:13:49 - main.xml] Parser is not a BridgeXmlBlockParser!
java.lang.NullPointerException
at android.view.View.<init>(View.java:1841)
at android.widget.TextView.<init>(TextView.java:326)
at com.android.layoutlib.bridge.MockView.<init>(MockView.java:33)
at android.view.SurfaceView.<init>(SurfaceView.java:45)
at android.view.SurfaceView.<init>(SurfaceView.java:41)
at android.view.SurfaceView.<init>(SurfaceView.java:37)
at android.opengl.GLSurfaceView.<init>(GLSurfaceView.java:189)
at
com.maximusdev.tests3d.ShapeSurfaceView.<init>(ShapeSurfaceView.java:
14)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(Unknown
Source)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:
198)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:
126)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:617)
at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
at android.view.LayoutInflater.inflate(LayoutInflater.java:296)
at com.android.layoutlib.bridge.Bridge.computeLayout(Bridge.java:377)
at
com.android.ide.eclipse.adt.internal.editors.layout.gle1.GraphicalLayoutEditor.computeLayout(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.gle1.GraphicalLayoutEditor.recomputeLayout(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.gle1.GraphicalLayoutEditor.onConfigurationChange(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.gle1.GraphicalLayoutEditor.onTargetChange(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor.onDescriptorsChanged(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor.initUiRootNode(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.gle1.GraphicalLayoutEditor
$1.updateEditor(Unknown Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.gle1.GraphicalLayoutEditor
$1.onTargetLoaded(Unknown Source)
at com.android.ide.eclipse.adt.AdtPlugin$16.run(Unknown Source)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:
134)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:
3855)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3476)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:
2405)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2369)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2221)
at org.eclipse.ui.internal.Workbench$5.run(Workbench


Sponsored Links


Other Threads

1. Setting up Eclipse to build NDK using Sequoyah

I am trying to set up Eclipse so that it can build my NDK piece.  I
have installed Sequoyah, and added the Native Support.  However, when
I build the project I get the error:

**** Build of configuration Default for project HelloJni ****

(Cannot run program "bash": Launching failed)

Can anyone tell me what I am doing wrong?

Thanks.

-- 

2. HTC auto zoom on HTML input fields

Hello Everyone,

Does anyone know how to disable the automatic zoom on input fields. I
think only the HTC phones have that issue (so far that's the only
phone reported).

My app utilizes a WebView where I load some HTML into it and adding a
JavaScript interface to a set of functions which are used from the
HTML.

I have one input field for a search box. On all my Android Phones
(Droid, DroidX, Captivate, Fascinate, etc, - even Emulator) it works
fine, however all the HTC's automatically zooms into the input field
on the webview and messes up the whole interface. I am removing the
users ability to zoom in and out (.setBuiltInZoomControls(false)), I
want that they stay within the current view.

How can I restrict that the HTC's are not automatically zooming into
the input field and work as the other Android phones?

Thanks,

Andy


-- 

3. Is Samsung Galaxy Tab NOT a large screen from application developer's point of view?

4. External Storage File Creation Problem

5. multiple images in a one single image

6. getting sensor information from native code (C or C++)

7. How to send data from android application to UART