トースト (親) 部分に到達するたびに、アプリケーションが常にクラッシュします。run() 全体を空にしてみましたが、問題はありませんでした。
このコードはエミュレータでは正常に機能しますが、デバイスでは機能しません。
必要に応じてトーストを無視してください。私の主な問題はトーストではなく、そのコード以降です。デバイスでクラッシュします。
アプリケーションがクラッシュした場所を知るためにトーストを使用しているだけです。
public class LoadingActivity extends Activity {
/** Duration of wait **/
private final int SPLASH_DISPLAY_LENGTH = 2000;
Intent intent;
LoadingActivity parent;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.activity_loading);
intent = getIntent();
parent = this;
ImageView logo = (ImageView) findViewById(R.id.imageView);
TextView splash = (TextView) findViewById(R.id.splash);
splash.setText(intent.getStringExtra(Constant.SPLASH_TEXT));
TranslateAnimation animator = new TranslateAnimation(logo.getX(), logo.getX(), logo.getY(), logo.getY() + 300);
animator.setDuration(2000);
animator.setFillAfter(true);
logo.startAnimation(animator);
/* New Handler to start the Menu-Activity
* and close this Splash-Screen after some seconds.*/
new Handler().postDelayed(new Runnable(){
@Override
public void run() {
//error on here
Toast.makeText(parent, "im still fine", Toast.LENGTH_LONG).show();
/* Create an Intent that will start the Menu-Activity. */
Intent nextIntent = new Intent(parent, HomeActivity.class);
nextIntent.putExtra(Constant.LOGIN_USERNAME, intent.getStringExtra(Constant.LOGIN_USERNAME));
parent.startActivity(nextIntent);
Toast.makeText(parent, "passed", Toast.LENGTH_LONG).show();
LoadingActivity.this.finish();
}
}, SPLASH_DISPLAY_LENGTH);
}
}