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. Google "not happy" with slow Android sales

Thought some of you might enjoy reading this:

 http://www.***.com/ 

It seems that Google is at least aware of the problem (that almost 
shocked me :), but not really sure what they are going to do about it :).


It's obviously an Apple site... so don't get too concerned with some of 
the comments.... it's bad for your {*filter*} pressure :).


Sincerely,

Brad Gies
-----------------------------------------------------------------------
Bistro Bot - Bistro Blurb
 http://www.***.com/              http://www.***.com/ 
 http://www.***.com/        http://www.***.com/ 
 http://www.***.com/ 
-----------------------------------------------------------------------
Everything in moderation, including abstinence (paraphrased)

Every person is born with a brain... Those who use it well are the successful 
happy ones - Brad Gies

Adversity can make or break you... It's your choice... Choose wisely - Brad Gies

Never doubt that a small group of thoughtful, committed people can
change the world. Indeed. It is the only thing that ever has - Margaret Mead

--
.

2. QSB (Quick Search Bar): make suggestions editable

How to make the suggestions in the QSB editable when the user clicks
on it, instead of triggering the actual search? I.e. via an edit icon
on the right, like on the Google Search app.

See screenshot: http://i.imgur.com/M1C6a.png

Is there a standard way to do it, or does it require to implement it
from scratch, i.e. customized suggestion list item layout in xml with
a button, custom searchbar implementation, etc.?

I couldn't find any info on that on
http://developer.android.com/intl/fr/guide/topics/search/searchable-config.html
and related docs.

-- 

3. [Need Help/WTA] Motorola Service Center di Area Surabaya. Motorola Defy Matot setelah flash dengan RSD Lite

4. APN settings

5. Phone call receiver activity to REPLACE Android BUILT-IN phone call receiver component

6. Clock Widget

7. Captain Wreckheck released!