Im trying to set the source of an ImageView to an AnimationDrawable but no matter what way I do it the app always crashes at that point. heres the animation resource:
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="#drawable/f11" android:duration="200" />
<item android:drawable="#drawable/f2" android:duration="200" />
<item android:drawable="#drawable/f3" android:duration="200" />
<item android:drawable="#drawable/f4" android:duration="200" />
<item android:drawable="#drawable/f5" android:duration="200" />
<item android:drawable="#drawable/f6" android:duration="200" />
<item android:drawable="#drawable/f7" android:duration="200" />
<item android:drawable="#drawable/f8" android:duration="200" />
<item android:drawable="#drawable/f9" android:duration="200" />
<item android:drawable="#drawable/f10" android:duration="200" />
<item android:drawable="#drawable/f11" android:duration="200" />
<item android:drawable="#drawable/f12" android:duration="200" />
<item android:drawable="#drawable/f13" android:duration="200" />
<item android:drawable="#drawable/f14" android:duration="200" />
</animation-list>
in my xml layout:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="#+id/banim"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:src="#anim/anim"
/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:layout_width="100dp"
android:layout_height="50dp"
android:id="#+id/play"
android:src="#drawable/play"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="50dp"
android:id="#+id/achievements"
android:src="#drawable/achievements"
/>
</LinearLayout>
</FrameLayout>
heres my activity:
public class Menu extends Activity {
AnimationDrawable animationDrawable;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.menu);
ImageView gif = (ImageView)findViewById(R.id.banim);
animationDrawable = (AnimationDrawable)gif.getBackground();
animationDrawable.start();
final Intent intent = new Intent(this, MyActivity.class);
final Intent intent1 = new Intent(this, Achievements.class);
final ImageView bplay = (ImageView)findViewById(R.id.play);
final ImageView bachieve = (ImageView)findViewById(R.id.achievements);
final View.OnClickListener buttonClickListener;
buttonClickListener = new View.OnClickListener() {
#Override
public void onClick(View view) {
if (view == bplay){
startActivity(intent);
}else if (view == bachieve){
startActivity(intent1);
}
}
};
bplay.setOnClickListener(buttonClickListener);
bachieve.setOnClickListener(buttonClickListener);
}
}
Ive tried setting it programmatically with
gif.setImageResource(R.anim.anim);
it crashes at that point. I tried moving anim to the drawable folder but still no luck.
can someone help me?
You must run your animation drawable from another thread other than the main thread, then update your code like this code snippet and it will work.
In Your activity do the follolwing:
public class Menu extends Activity {
AnimationDrawable animationDrawable;
ImageView gif ;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.menu);
// the fix is here
gif = (ImageView)findViewById(R.id.banim);
gif.setImageResource(R.anim.anim);
Starter starter = new Starter();
gif.post(starter);
final Intent intent = new Intent(this, MyActivity.class);
final Intent intent1 = new Intent(this, Achievements.class);
final ImageView bplay = (ImageView)findViewById(R.id.play);
final ImageView bachieve = (ImageView)findViewById(R.id.achievements);
final View.OnClickListener buttonClickListener;
buttonClickListener = new View.OnClickListener() {
#Override
public void onClick(View view) {
if (view == bplay){
startActivity(intent);
}else if (view == bachieve){
startActivity(intent1);
}
}
};
bplay.setOnClickListener(buttonClickListener);
bachieve.setOnClickListener(buttonClickListener);
}
class Starter implements Runnable {
public void run() {
// Get the background, which has been compiled to an
// AnimationDrawable
// object.
AnimationDrawable frameAnimation = (AnimationDrawable) gif
.getBackground();
frameAnimation.setOneShot(false);
// Start the animation (looped playback by default).
frameAnimation.start();
}
}
}
Related
i want to ask that i want to make this animation as single image and wanted to apply some other view animation on it like move or alpha etc. how this can be done ? any idea ? simply i wanted to apply view animation on drawable animation.
i have some drawable like s1,s2,s3,s4 to s16 the XML is
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="#drawable/s1" android:duration="200" />
<item android:drawable="#drawable/s2" android:duration="200" />
<item android:drawable="#drawable/s3" android:duration="200" />
<item android:drawable="#drawable/s12" android:duration="200" />
<item android:drawable="#drawable/s13" android:duration="200" />
<item android:drawable="#drawable/s14" android:duration="200" />
<item android:drawable="#drawable/s15" android:duration="200" />
<item android:drawable="#drawable/s16" android:duration="200" />
</animation-list>
and java code is
anim = (ImageView) findViewById(R.id.black);
anim.setBackgroundResource(R.drawable.smurf);
AnimationDrawable hello = (AnimationDrawable) anim.getBackground();
hello.start();
here smurf in drawable is the xml file for drawable animation.
we can do that animation but we have to maintain handler for that.
private int index = 0;
private Handler handler = new Handler();
private AnimationDrawable drawable;
Runnable runnable = new Runnable() {
#Override
public void run() {
imageView.setImageDrawable(drawable.getFrame(index));
index++;
if (index == drawable.getNumberOfFrames()) {
index = 0;
}
handler.postDelayed(runnable, drawable.getDuration(index));
}
};
in your onclick or where you want to start animation write like this:
handler.postDelayed(runnable, drawable.getDuration(index));
and your onDestroy() remove the handeler call backs like this:
protected void onDestroy() {
super.onDestroy();
handler.removeCallbacks(runnable);
}
When I launch the emulator, the animation only plays the first frame of the animation, sits for the duration of the timer and then starts the activity.
This is my Drawable xml
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="#drawable/title1" android:duration="200" />
<item android:drawable="#drawable/title2" android:duration="200" />
<item android:drawable="#drawable/title3" android:duration="200" />
<item android:drawable="#drawable/title4" android:duration="200" />
<item android:drawable="#drawable/title5" android:duration="200" />
<item android:drawable="#drawable/title6" android:duration="200" />
<item android:drawable="#drawable/title7" android:duration="200" />
<item android:drawable="#drawable/title8" android:duration="200" />
<item android:drawable="#drawable/title9" android:duration="200" />
<item android:drawable="#drawable/title10" android:duration="200" />
<item android:drawable="#drawable/title11" android:duration="200" />
</animation-list>
This is my layout xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<ImageView
android:id="#+id/gyro"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerInParent="true"
/>
This is my java file
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
// Start the animation (looped playback by default).
ImageView splash = (ImageView) findViewById(R.id.gyro);
splash.setBackgroundResource(R.drawable.title);
AnimationDrawable splashAnimation = (AnimationDrawable) splash.getBackground();
splashAnimation.start();
Thread logoTimer = new Thread(){
public void run(){
try{
int logoTimer = 0;
while(logoTimer <10000){
sleep(100);
logoTimer = logoTimer + 100;
}//end of while loop
//mpsplash.stop();
startActivity(new Intent("tv.bScienceFiction.scrip.or.scrap.CLEARSCREEN"));
} catch (InterruptedException e) {
//TODO Auto-generated catch block
e.printStackTrace();
}
finally{
finish();
}//end of finally
}//end of run
};//end of new Thread
logoTimer.start();
}
Start it from the UI thread after you exit onCreate
splash.postDelayed(new Runnable() {
public void run() {
splashAnimation.start();
}
}, 200);
I am working on apps in which i want to run two frame animation simultaneously but it is not working....
my code is as follow....
ImageView Background, planet, info;
AnimationDrawable infoview, backgroundview;
#Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Background = (ImageView) findViewById(R.id.imageView1);
planet = (ImageView) findViewById(R.id.planet);
//Background.setImageResource(R.drawable.friend_night_sky_31000);
Log.w("debug", "planetanimation started");
planetStart(R.drawable.earth, R.drawable.background);
Log.w("debug", "planetanimation stoped");
info = (ImageView) findViewById(R.id.info);
info.setImageResource(R.drawable.earthinfo);
Log.w("DEBUG", "which is null:image " + infoview + "or" + backgroundview);
}
public void planetStart(final int pid, final int bid){
Thread timer = new Thread(){
#Override
public void run(){
try{
//Thread.sleep(time);
} catch (Exception e){
} finally{
Infoview.this.runOnUiThread(new Runnable(){
public void run(){
planet.setBackgroundResource(pid);
infoview = (AnimationDrawable) planet.getBackground();
infoview.start();
Background.setBackgroundResource(bid);
backgroundview = (AnimationDrawable) Background.getBackground();
backgroundview.start();
Log.w("DEBUG", "which is null:image " + infoview + "or" + backgroundview);
}
});
}
}
};
timer.start();
}
can any one help me why it is not working ?
Edit1 my earth file is as follow
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
>
<item android:drawable="#drawable/earthframe1" android:duration="150" />
<item android:drawable="#drawable/earthframe2" android:duration="150" />
<item android:drawable="#drawable/earthframe3" android:duration="150" />
<item android:drawable="#drawable/earthframe4" android:duration="150" />
<item android:drawable="#drawable/earthframe5" android:duration="150" />
<item android:drawable="#drawable/earthframe6" android:duration="150" />
<item android:drawable="#drawable/earthframe7" android:duration="150" />
<item android:drawable="#drawable/earthframe8" android:duration="150" />
<item android:drawable="#drawable/earthframe9" android:duration="150" />
</animation-list>
and bg file is as follow
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="#drawable/bg_1" android:duration="150" />
<item android:drawable="#drawable/bgimage2" android:duration="150" />
<item android:drawable="#drawable/bgimage03" android:duration="150" />
<item android:drawable="#drawable/bgimage4" android:duration="150" />
<item android:drawable="#drawable/bgimage5" android:duration="150" />
</animation-list>
you have two solution either u can remove thread from the planetStart method or if u want to go with an exisiting code than give some value like Thread.sleep(1000); in thread sleep i have checked with this value and it works for me one more thing avoid second animation starting before the ending of first animation
Try Below code
package org.sample;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.util.Log;
import android.widget.ImageView;
public class SampleActivity extends Activity
{
ImageView Background, planet, info;
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Background = (ImageView) findViewById(R.id.imageView1);
Background.setBackgroundResource(R.drawable.background);
planet = (ImageView) findViewById(R.id.planet);
planet.setBackgroundResource(R.drawable.earth);
info = (ImageView) findViewById(R.id.info);
info.setImageResource(R.drawable.earthinfo);
AnimationDrawable BackgroundAnimation = (AnimationDrawable) Background.getBackground();
BackgroundAnimation.start();
AnimationDrawable PlanetAnimation = (AnimationDrawable) planet.getBackground();
PlanetAnimation.start();
}
}
You can't start animation in onCreate (and yes, you do this). You should read this carefully (especially last example with paragraph).
I'm having a little trouble getting an animated loading spinner to work for a splash page. Nothing shows up when I try to run the following code. Any suggestions? It seems that quite a few people have issues with this on google but I do not understand why mine is failing to work. Thanks!
animationloader.xml
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="#drawable/loadingspinner1" android:duration="200" />
<item android:drawable="#drawable/loadingspinner2" android:duration="200" />
<item android:drawable="#drawable/loadingspinner3" android:duration="200" />
<item android:drawable="#drawable/loadingspinner4" android:duration="200" />
<item android:drawable="#drawable/loadingspinner5" android:duration="200" />
<item android:drawable="#drawable/loadingspinner6" android:duration="200" />
<item android:drawable="#drawable/loadingspinner7" android:duration="200" />
<item android:drawable="#drawable/loadingspinner8" android:duration="200" />
<item android:drawable="#drawable/loadingspinner9" android:duration="200" />
<item android:drawable="#drawable/loadingspinner01" android:duration="200" />
<item android:drawable="#drawable/loadingspinner11" android:duration="200" />
<item android:drawable="#drawable/loadingspinner12" android:duration="200" />
</animation-list>
SplashScreen.java
package com.secure.inmatecanteen;
import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.widget.ImageView;
public class SplashScreen extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splashscreen);
//Beginning the loading animation as we attempt to verify registration with SIP
ImageView ivLoader = (ImageView) findViewById(R.id.IVloadinganimation);
ivLoader.setBackgroundResource(R.anim.animationloader);
AnimationDrawable frameAnimation = (AnimationDrawable) ivLoader.getBackground();
frameAnimation.start();
}
}
splashscreen.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:background="#android:color/white" >
<ImageView
android:id="#+id/iclogo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="#drawable/iclogo"
android:adjustViewBounds="true"
/>
<ImageView
android:id="#+id/IVloadinganimation"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:adjustViewBounds="true"
/>
</LinearLayout>
Solved my own problem, You cannot start animations in the oncreate. It has to be in an onclick listener or inside a runnable.
I think the most elegant and versatile option is to extend from the ImageView class:
public class Loader extends ImageView {
public Loader(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init();
}
public Loader(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public Loader(Context context) {
super(context);
init();
}
private void init() {
setBackgroundResource(R.drawable.loader);
final AnimationDrawable frameAnimation = (AnimationDrawable) getBackground();
post(new Runnable(){
public void run(){
frameAnimation.start();
}
});
}
}
The loader.xml located in the drawable folder:
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="#drawable/loader_1" android:duration="50" />
<item android:drawable="#drawable/loader_2" android:duration="50" />
<item android:drawable="#drawable/loader_3" android:duration="50" />
<item android:drawable="#drawable/loader_4" android:duration="50" />
.....
</animation-list>
Now include in your views something as simple as this:
<com.yourpackage.Loader
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
You can play/start animation from onWindowFocusChanged(boolean hasFocus) method.
Don't set image resource in xml code.
My XML is:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:gravity="center"
android:keepScreenOn="true"
android:id="#+id/splashLayout"
android:background="#color/colorPrimary"
android:layout_height="match_parent">
<ImageView
android:layout_width="230dp"
android:layout_height="230dp"
android:id="#+id/iv_splash"
android:layout_marginTop="-80dp"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
In Activity i do
public class SplashActivity extends Activity {
ImageView iv_splash;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
iv_splash=(ImageView)findViewById(R.id.iv_splash);
iv_splash.setBackgroundResource(R.drawable.splash);
final AnimationDrawable progressAnimation =(AnimationDrawable)iv_splash.getBackground();
progressAnimation.start();
}
}
Drawable file
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false" >
<item android:drawable="#drawable/logo" android:duration="400"/>
<item android:drawable="#drawable/logo1" android:duration="400"/>
</animation-list>
It's Working Good :)
Within this handler the animation is not fully attached to the window, so the animations can’t be started; instead, this is usually done as a result to user action (such as a button press) or within the onWindowFocusChangedhandler.
refer: professional android 4 application development
Check GitHub project here I have implemented: Check here
My MainActivity.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:background="#color/colorPrimaryDark"
tools:context=".MainActivity">
<ImageView
android:id="#+id/animation_imageview"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_centerHorizontal="true"
android:src="#drawable/animation_frame"
android:scaleType="fitCenter"
android:layout_marginBottom="50dp"/>
<TextView
android:layout_below="#+id/animation_imageview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:textSize="20sp"
android:textStyle="bold"
android:textColor="#fff"
android:fontFamily="sans-serif-thin"
android:text="Converting Please wait..."/>
</RelativeLayout>
My animation-list in drawable
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="#drawable/ic_covert_f1" android:duration="90"/>
<item android:drawable="#drawable/ic_covert_f2" android:duration="90"/>
<item android:drawable="#drawable/ic_covert_f3" android:duration="90"/>
<item android:drawable="#drawable/ic_covert_f4" android:duration="90"/>
<item android:drawable="#drawable/ic_covert_f5" android:duration="90"/>
<item android:drawable="#drawable/ic_covert_f6" android:duration="90"/>
<item android:drawable="#drawable/ic_covert_f7" android:duration="90"/>
<item android:drawable="#drawable/ic_covert_f8" android:duration="90"/>
<item android:drawable="#drawable/ic_covert_f9" android:duration="90"/>
<item android:drawable="#drawable/ic_covert_f10" android:duration="90"/>
<item android:drawable="#drawable/ic_covert_f11" android:duration="90"/>
</animation-list>
My MainActivty.java
Always remember to use Runnable to start the animation
public class MainActivity extends AppCompatActivity {
AnimationDrawable progressAnimation;
ImageView imageView;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imageView = (ImageView)findViewById(R.id.animation_imageview);
progressAnimation = (AnimationDrawable)imageView.getDrawable();
progressAnimation.setCallback(imageView);
progressAnimation.setVisible(true, true);
imageView.post(new Starter());
}
class Starter implements Runnable {
public void run() {
progressAnimation.start();
}
}
}
Works Perfectly Good Luck :)
Elegant solution - create your own Animated View which will follow life-cycle rules.
public class AnimatedImageView extends android.support.v7.widget.AppCompatImageView {
public AnimatedImageView(Context context, AttributeSet attrs) {
super(context, attrs);
setImageDrawable(ContextCompat.getDrawable(
context, R.drawable.animated_icon));
}
#Override
protected void onAttachedToWindow() {
// It's important to note that the start() method called on
// the AnimationDrawable cannot be called during the onCreate()
// method of your Activity, because the AnimationDrawable
// is not yet fully attached to the window.
super.onAttachedToWindow();
AnimationDrawable tapAnimation = (AnimationDrawable) getDrawable();
tapAnimation.start();
}
}
here is animated_icon.xml
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="#drawable/tap_icon_1" android:duration="500" />
<item android:drawable="#drawable/tap_icon_2" android:duration="500" />
</animation-list>
I have to repeat the image sequence I am using with Thread and AnimationDrawable but it is not working continuously. I don't want to stop this animation until next activity is started through button click event.
Here is my java code:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);{
final ImageView splashImage=(ImageView)findViewById(R.id.heartFunction);
splashImage.setBackgroundResource(R.drawable.slide_right);
splashAnimation = (AnimationDrawable) splashImage.getBackground();
}
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if ( isFocused ) {
//isFocused = false;
splashAnimation.start();
var=false;
new Thread(new Runnable() {
public void run() {
try {
Thread.sleep(SPLASH_DISPLAY_LENGTH);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
}
slide_right.xml:-
<?xml version="1.0" encoding="utf-8"?>
<animation-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="#drawable/heartcolored0" android:duration="200" />
<item android:drawable="#drawable/heartcolored2" android:duration="200" />
<item android:drawable="#drawable/heartcolored4" android:duration="200" />
<item android:drawable="#drawable/heartcolored5" android:duration="200" />
<item android:drawable="#drawable/heartcolored6" android:duration="200" />
<item android:drawable="#drawable/heartcolored7" android:duration="200" />
<item android:drawable="#drawable/heartcolored8" android:duration="200" />
<item android:drawable="#drawable/heartcolored9" android:duration="200" />
<item android:drawable="#drawable/heartcolored10" android:duration="200" />
<item android:drawable="#drawable/heartcolored11" android:duration="200" />
<item android:drawable="#drawable/heartcolored12" android:duration="200" />
<item android:drawable="#drawable/heartcolored13" android:duration="200" />
</animation-list>
If you want your animation to contiuously run then you need to set android:oneshot="false"
You were saying before to only run through once.
If you want an animation to run until you click the screen to go to the next activity. Start the animation when the onWindowFocusChanged function
#Override
public void onWindowFocusChanged(boolean hasFocus){
splashanimation.start();
}
Then use an onTouchEvent to catch the touch, start a new activity and finish the old activity.
#Override
public boolean onTouchEvent(MotionEvent event){
if (event.getAction() == MotionEvent.ACTION_DOWN) {
Intent i = new Intent(Anim.this, Main.class);
startActivity(i);
finish();
}
return true;
}
Hope this helps, your question is very hard to read/understand.