Я пытаюсь раздуть представление, которое служит экраном загрузки для моего glSurfaceView
, в то время как оно меняет текстуры во время выполнения (я знаю, как это сделать во время моего onCreate
просто отлично). Это просто RelativeLayout
с индикатором выполнения в середине, и когда он завершается со свопом, он исчезает, но он не раздувается правильно.
inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
loading = inflater.inflate(R.layout.loading,null);
RelativeLayout loadingScreen = (RelativeLayout) findViewById(R.id.loadingScreen);
, где loadingScreen - идентификатор относительного макета.
XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/loadingScreen"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
android:visibility="visible" >
<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" >
</ProgressBar>
<EditText
android:id="@+id/editText android:layout_height="
android:layout_width="wrap_content"
wrap_content="" >
</EditText>
</RelativeLayout>
Для теста я добавил EditText над следующим дополнительным кодом, чтобы проверить его:
EditText tester = (EditText) findViewById(R.id.editText); //Now we have an object
tester.setText("dfdfds");
и журнал ошибок:
08-12 15:07:35.630: ERROR/ActivityThread(2502): Failed to inflate
08-12 15:07:35.630: ERROR/ActivityThread(2502): android.view.InflateException: Binary XML file line #5: Error inflating class com.huskybus.CampusMapOpenGL
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:212)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.app.Activity.setContentView(Activity.java:1657)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at com.huskybus.Main.onCreate(Main.java:91)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1722)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.os.Handler.dispatchMessage(Handler.java:99)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.os.Looper.loop(Looper.java:130)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.app.ActivityThread.main(ActivityThread.java:3835)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at java.lang.reflect.Method.invokeNative(Native Method)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at java.lang.reflect.Method.invoke(Method.java:507)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at dalvik.system.NativeStart.main(Native Method)
08-12 15:07:35.630: ERROR/ActivityThread(2502): Caused by: java.lang.reflect.InvocationTargetException
08-12 15:07:35.630: ERROR/ActivityThread(2502): at java.lang.reflect.Constructor.constructNative(Native Method)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
08-12 15:07:35.630: ERROR/ActivityThread(2502): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
08-12 15:07:35.630: ERROR/ActivityThread(2502): ... 21 more
08-12 15:07:35.630: ERROR/ActivityThread(2502): Caused by: java.lang.NullPointerException
08-12 15:07:35.630: ERROR/ActivityThread(2502): at com.huskybus.CampusMapOpenGL.<init>(CampusMapOpenGL.java:101)
08-12 15:07:35.630: ERROR/ActivityThread(2502): ... 24 more
08-12 15:07:35.637: DEBUG/AndroidRuntime(2502): Shutting down VM
08-12 15:07:35.637: WARN/dalvikvm(2502): threadid=1: thread exiting with uncaught exception (group=0x40015560)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): FATAL EXCEPTION: main
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.huskybus/com.huskybus.Main}: android.view.InflateException: Binary XML file line #5: Error inflating class com.huskybus.CampusMapOpenGL
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1768)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1784)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.app.ActivityThread.access$1500(ActivityThread.java:123)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.os.Handler.dispatchMessage(Handler.java:99)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.os.Looper.loop(Looper.java:130)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.app.ActivityThread.main(ActivityThread.java:3835)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at java.lang.reflect.Method.invokeNative(Native Method)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at java.lang.reflect.Method.invoke(Method.java:507)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:847)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:605)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at dalvik.system.NativeStart.main(Native Method)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): Caused by: android.view.InflateException: Binary XML file line #5: Error inflating class com.huskybus.CampusMapOpenGL
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.view.LayoutInflater.createView(LayoutInflater.java:518)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:570)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:212)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.app.Activity.setContentView(Activity.java:1657)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at com.huskybus.Main.onCreate(Main.java:91)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1722)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): ... 11 more
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): Caused by: java.lang.reflect.InvocationTargetException
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at java.lang.reflect.Constructor.constructNative(Native Method)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at android.view.LayoutInflater.createView(LayoutInflater.java:505)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): ... 21 more
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): Caused by: java.lang.NullPointerException
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): at com.huskybus.CampusMapOpenGL.<init>(CampusMapOpenGL.java:101)
08-12 15:07:35.653: ERROR/AndroidRuntime(2502): ... 24 more