• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps about using animationDrawable and intent - Help me!

I'mpinky

Lurker
Hi
I'm trying to simple game using animation and intent.
it's my activityclass code
///////////////////////////////////////////////////////////////////////////////////
public class AnimationStwie extends Activity implements OnClickListener{
/** Called when the activity is first created. */
AnimationDrawable animation;


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView imageAnim = (ImageView) findViewById(R.id.img);
imageAnim.setBackgroundResource(R.drawable.mani);
animation = (AnimationDrawable)imageAnim.getBackground();
imageAnim.post(new Starter());

Button button1 = (Button)findViewById(R.id.Start);
button1.setOnClickListener(this);
Button button2 = (Button)findViewById(R.id.GetScore);
button2.setOnClickListener(this);

}
@Override
public void onClick(View arg0) {
// int id = arg0.getId();
// if (id == R.id.Start) {
sendStart();
// } else if (id == R.id.GetScore) {
// }
// TODO Auto-generated method stub
}
private void sendStart() {
Intent intent = new Intent(AnimationStwie.this,
LaunchedActivity.class);
startActivity(intent);
}
class Starter implements Runnable {
public void run() {
animation.start();

}
}
}
/////////////////////////////////////////////////////////////////////////////////
i'm using UIthread as using Starter class..

and second activity class(LaunchedActivity.class)
//////////////////////////////////////////////////////////////////////////////
public class LaunchedActivity extends Activity {//implements OnTouchListener{
// public static String TAG = "TouchPlay";
AudioClip soundjump, soundgigle, soundpong;
AnimationDrawable animation1;
@Override
public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.layout.layout1);
ImageView imageAnim = (ImageView) findViewById(R.id.img2);
imageAnim.setBackgroundResource(R.drawable.seacti);
animation1 = (AnimationDrawable)imageAnim.getBackground();
imageAnim.post(new Starter1());
soundjump = new AudioClip(this, R.raw.cartoon);
soundgigle= new AudioClip(this, R.raw.giggle);
soundpong = new AudioClip(this, R.raw.funny);
}
class Starter1 implements Runnable {
public void run() {
animation1.start();

}
}
}
///////////////////////////////////////////////////////////////////////////////
I'm also using Runnable class(Starter1) as well
there are thread errors....


if i didn't use animationDrawable in LaunchedActivity class, only in AnimationStwie Activity class, it works. but i want to use it in intented class,, but after calling intent(if i used animationDrable with Runnable class in second activity) there were thread errors ..
i don't know why.

please help me!!!!!!!!!
 
Back
Top Bottom