-1

I write a simple code to test GLSurfaceView.

package com.jeobin.test;

import android.app.Activity;
import android.os.Bundle;
import android.opengl.GLSurfaceView;

public class MainActivity extends Activity {
    GLSurfaceView view; 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        view = new GLSurfaceView(this);
        setContentView(view);
    }
}

when I add setContentView(view) in code, it breaks down. here is my manifest.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.jeobin.test"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-feature android:glEsVersion="0x00020000" android:required="true" />
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

is something wrong with eclipse?

Adnan
  • 5,025
  • 5
  • 25
  • 44

1 Answers1

0

What do you mean by "breaks down"? Does it run at all? In order to use OpenGL ES, you have to write a renderer class, and set it to the GLSurfaceView using setRenderer(). Check this out: http://www.learnopengles.com/android-lesson-one-getting-started/

Tristram
  • 176
  • 1
  • 8
  • when i open this app in my note3, it shows "unfortunately, test has stooped". here, i just do a test code to test the GLSurface can work or not. in my another code, i do write a renderer.class. – joebin wu Aug 28 '14 at 16:28
  • I think the problem is that you need to set the renderer to the GLSurfaceView class before you call setContentView. – Tristram Aug 28 '14 at 17:29