i am facing a problem while running the app
I have three activities, there are-- MainActivity.java , a splash activity, and another activity called AirportGuide.
now when i run the app on the emulator, the splash sound is playing, but the screen is blank. after three seconds of splash, a new screen opens which is also blank. the app was working fine before i added AirportGuide class
here is the MainActivity.java
package com.shashank.sharjahinternationalairport;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
public class MainActivity extends Activity {
ImageButton flightInfoButton;
ImageButton airportGuideButton;
ImageButton visitorInfoButton;
ImageButton saaDcaButton;
ImageButton cargoButton;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
flightInfoButton = (ImageButton) findViewById(R.id.flightInfo);
visitorInfoButton = (ImageButton) findViewById(R.id.visitorInfo);
saaDcaButton = (ImageButton) findViewById(R.id.saaDca);
cargoButton = (ImageButton) findViewById(R.id.cargo);
airportGuideButton = (ImageButton) findViewById(R.id.airportGuide);
airportGuideButton.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View V){
Intent openAirportGuide = new Intent( MainActivity.this, AirportGuide.class);
startActivity(openAirportGuide);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
and this is the AndroidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.shashank.sharjahinternationalairport"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.shashank.sharjahinternationalairport.Splash"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.shashank.sharjahinternationalairport.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.shashank.sharjahinternationalairport.MAINACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.shashank.sharjahinternationalairport.AirportGuide"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.shashank.sharjahinternationalairport.AIRPORTGUIDE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
this is the stack trace
02-13 13:01:50.808: E/eglCodecCommon(2345): writeFully: failed: Broken pipe
02-13 13:01:50.808: E/eglCodecCommon(2345): writeFully: failed: Broken pipe
02-13 13:01:50.808: W/libEGL(2345): eglInitialize(0x96a31040) failed (EGL_SUCCESS)
02-13 13:01:50.808: E/EGL_genymotion(2345): tid 2345: eglChooseConfig(576): error 0x3001 (EGL_NOT_INITIALIZED)
02-13 13:01:50.808: D/AndroidRuntime(2345): Shutting down VM
02-13 13:01:50.808: W/dalvikvm(2345): threadid=1: thread exiting with uncaught exception (group=0xa4cfdb20)
02-13 13:01:50.812: E/AndroidRuntime(2345): FATAL EXCEPTION: main
02-13 13:01:50.812: E/AndroidRuntime(2345): Process: com.shashank.sharjahinternationalairport, PID: 2345
02-13 13:01:50.812: E/AndroidRuntime(2345): java.lang.IllegalArgumentException: eglChooseConfig failed EGL_NOT_INITIALIZED
02-13 13:01:50.812: E/AndroidRuntime(2345): at android.view.HardwareRenderer$GlRenderer.chooseEglConfig(HardwareRenderer.java:1173)
02-13 13:01:50.812: E/AndroidRuntime(2345): at android.view.HardwareRenderer$GlRenderer.loadEglConfig(HardwareRenderer.java:1135)
02-13 13:01:50.812: E/AndroidRuntime(2345): at android.view.HardwareRenderer$GlRenderer.initializeEgl(HardwareRenderer.java:1117)
02-13 13:01:50.812: E/AndroidRuntime(2345): at android.view.HardwareRenderer$GlRenderer.initialize(HardwareRenderer.java:1057)
02-13 13:01:50.812: E/AndroidRuntime(2345): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1550)
02-13 13:01:50.812: E/AndroidRuntime(2345): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
02-13 13:01:50.812: E/AndroidRuntime(2345): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
02-13 13:01:50.812: E/AndroidRuntime(2345): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
02-13 13:01:50.812: E/AndroidRuntime(2345): at android.view.Choreographer.doCallbacks(Choreographer.java:574)
02-13 13:01:50.812: E/AndroidRuntime(2345): at android.view.Choreographer.doFrame(Choreographer.java:544)
02-13 13:01:50.812: E/AndroidRuntime(2345): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
02-13 13:01:50.812: E/AndroidRuntime(2345): at android.os.Handler.handleCallback(Handler.java:733)
02-13 13:01:50.812: E/AndroidRuntime(2345): at android.os.Handler.dispatchMessage(Handler.java:95)
02-13 13:01:50.812: E/AndroidRuntime(2345): at android.os.Looper.loop(Looper.java:136)
02-13 13:01:50.812: E/AndroidRuntime(2345): at android.app.ActivityThread.main(ActivityThread.java:5017)
02-13 13:01:50.812: E/AndroidRuntime(2345): at java.lang.reflect.Method.invokeNative(Native Method)
02-13 13:01:50.812: E/AndroidRuntime(2345): at java.lang.reflect.Method.invoke(Method.java:515)
02-13 13:01:50.812: E/AndroidRuntime(2345): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
02-13 13:01:50.812: E/AndroidRuntime(2345): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
02-13 13:01:50.812: E/AndroidRuntime(2345): at dalvik.system.NativeStart.main(Native Method)
this is the splash activity
package com.shashank.sharjahinternationalairport;
import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
public class Splash extends Activity{
MediaPlayer splashSound;
@Override
protected void onCreate(Bundle splashScreen) {
// TODO Auto-generated method stub
super.onCreate(splashScreen);
setContentView(R.layout.splash);
splashSound = MediaPlayer.create(Splash.this, R.raw.splashsound);
splashSound.start();
Thread timer = new Thread(){
public void run(){
try{
sleep(3200);
} catch (InterruptedException e){
e.printStackTrace();
}finally{
Intent openMainActivity = new Intent("com.shashank.sharjahinternationalairport.MAINACTIVITY");
startActivity(openMainActivity);
}
}
};
timer.start();
}
@Override
protected void onPause() {
// TODO Auto-generated method stub
super.onPause();
splashSound.release();
finish();
}
}
Restart your emulator. Test this on a hardware device and it will probably work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With