Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
I am currently trying to make a splash screen for a game. Im using android - eclipse. I have viewed probably ten different tutorials on how to do animations and I still get the same affect. My code is error free but when I run it it crashes. The only error that comes up in my logcat is " error opening trace file: No such file or directory(2)" I have no idea what it is talking about and haven't found any answers on google.
 
Here is my code for my splash screen
package com.dooberz.z_day;
 
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.view.MotionEvent;
import android.widget.ImageView;
 
public class SplashActivity extends Activity 
{
	//The thread to process splash screen events
	
	private Thread mSplashThread;
	
	//Called when the activity is first created.
	@Override
	public void  onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
		
		//Splash screen view
		setContentView(R.layout.activity_splash);
		final SplashActivity splashScreen = this;
		
		final ImageView splashImageView = (ImageView) findViewById(R.id.SplashZombieImage);
		splashImageView.setBackgroundResource(R.drawable.zombie_anim);
		final AnimationDrawable frameAnimation = (AnimationDrawable)splashImageView.getBackground();
		
		splashImageView.post(new Runnable()
		{
			@Override
			public void run()
			{
				frameAnimation.start();
			}
		});
		
		//The thread to wait for splash screen events
		mSplashThread = new Thread()
		{
			@Override
			public void run()
			{
				try{
					synchronized(this)
					{
						//wait give period of time or exit on touch
						wait(5000);
					}
				}
				catch(InterruptedException e)
				{}
				
				finish();
				//Run next Activity
				Intent intent = new Intent();
				intent.setClass(splashScreen, MainActivity.class);
				startActivity(intent);
				
			}
		};
		mSplashThread.start();
         }
	
	//Processes splash screen touch events
	@Override
	public boolean onTouchEvent(MotionEvent evt)
	{
		if(evt.getAction() == MotionEvent.ACTION_DOWN)
		{
			synchronized(mSplashThread)
			{
				mSplashThread.notifyAll();
			}
		}
		return true;
	}
}
 
Here is my animation list. I also have the three pictures in my res/drawable folder as well
?xml version="1.0" encoding="utf-8"?>
Posted 5-May-13 10:28am
Dooberz305

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 OriginalGriff 120
3 PIEBALDconsult 110
4 BillWoodruff 85
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 5 May 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100