以下のコードでアニメーションが機能しない理由を教えてください。また、スライドアウトの作り方も教えてください。私は自分のレベルを試しているので、可能な限りこれを行う方法を教えてください. もう1つ、以下のコードでマッピングの概念を使用しています。明確化が必要な場合はお知らせください
public class Erispage2Activity extends Activity
{
ErisImageMap ErisImageMap;
MediaPlayer audioStory;
Button play;
Button stop;
TextView txtPage1;
private SeekBar volumeSeekbar = null;
private AudioManager audioManager = null;
Animation animation;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
//overridePendingTransition(R.anim.fadein, R.anim.fadeout);
setContentView(R.layout.page1);
audioStory = new MediaPlayer();
audioStory = MediaPlayer.create(Erispage2Activity.this, R.raw.november_titanic);
play=(Button) findViewById(R.id.erispage2play);
stop=(Button) findViewById(R.id.erispage2stop);
txtPage1=(TextView) findViewById(R.id.textPage);
ErisImageMap = (ErisImageMap)findViewById(R.id.map);
ErisImageMap.setImageResource(R.drawable.learningui);
volumeSeekbar = (SeekBar)findViewById(R.id.seekBar1);
// volumeSeekbar.setBackgroundResource(R.drawable.seekbg);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
initControls();
txtPage1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
audioStory.start();
}
});
ErisImageMap.addOnImageMapClickedHandler(new ErisImageMap.OnImageMapClickedHandler()
{
public void onImageMapClicked(int id)
{
try
{
if(id==R.id.erispage2next)
{
Intent i=new Intent(Erispage2Activity.this,Erispage3Activity.class);
startActivity(i);
ErisImageMap.bit.recycle();
System.gc();
finish();
audioStory.stop();
}
if(id==R.id.erispage2play)
{
startAnimationPopOut();
audioStory.start();
// play.setBackgroundColor(Color.RED);
play.setVisibility(View.INVISIBLE);
// play.c
}
if(id==R.id.erispage2stop)
{
audioStory.pause();
play.setVisibility(View.VISIBLE);
setVolumeControlStream(AudioManager.STREAM_MUSIC);
stop.setVisibility(View.INVISIBLE);
}
}
catch (Exception e)
{
e.printStackTrace();
}
finally{
// ErisImageMap.bit.recycle();
}
}
public void onBubbleClicked(int id)
{
}
});
}
private void startAnimationPopOut()
{
ErisImageMap = (ErisImageMap)findViewById(R.id.map);
animation = AnimationUtils.loadAnimation(Erispage2Activity.this,R.anim.fadeout);
animation.setAnimationListener(new AnimationListener()
{
public void onAnimationStart(Animation animation)
{
// TODO Auto-generated method stub
// overridePendingTransition(R.anim.grid_entry,R.anim.grid_exit);
}
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
// overridePendingTransition(R.anim.fadein,R.anim.fadeout);
}
public void onAnimationEnd(Animation animation)
{
// TODO Auto-generated method stub
// overridePendingTransition(R.anim.grid_entry,R.anim.grid_exit);
overridePendingTransition( R.anim.slide_in_left, R.anim.slide_out_left );
}
});
ErisImageMap.clearAnimation();
ErisImageMap.startAnimation(animation);
}