خرید بک لینک

Vote count: 0

I have a welcome layout that is my first layout when start the app . I can run the project succeed in other devices and Android Studio emulator.

But when i try to run on Genymotion emulator with Samsung Galaxy series , it show the error FATAL EXCEPTION: main Process: com.example.huaweb_system.taiwanuniversityhome, PID: 2325 java.lang.OutOfMemoryError: Failed to allocate a 157286412 byte allocation with 6136736 free bytes and 87MB until OOM and mark this code at com.example.huaweb_system.taiwanuniversityhome.StartSplash.onCreate(StartSplash.java:49)

Here is my welcome layout class: public class StartSplash extends AppCompatActivity {

private ImageView imageStartSplash;
private static final int GOTO_MAIN_ACTIVITY = 1;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    setContentView(R.layout.activity_start_splash);//show error on this line

    handler.sendEmptyMessageDelayed(GOTO_MAIN_ACTIVITY, 4000);

    imageStartSplash = (ImageView) findViewById(R.id.imageStartSplash);
    //fade out image
    AlphaAnimation alpha = new AlphaAnimation(1.0F, 0.0F);
    alpha.setDuration(4000);
    alpha.setFillAfter(true);
    imageStartSplash.setAnimation(alpha);

}

//delay setting
private Handler handler = new Handler() {
    public void handleMessage(Message msg) {
        switch (msg.what) {
            case GOTO_MAIN_ACTIVITY:
                Intent intent = new Intent(StartSplash.this, MainActivity.class);
                startActivity(intent);
                finish();
                break;
            default:
                break;
        }
    }
};

}

I really don't know why ? I try to remove them like:

//imageStartSplash = (ImageView) findViewById(R.id.imageStartSplash);
//fade out image
//AlphaAnimation alpha = new AlphaAnimation(1.0F, 0.0F);
//alpha.setDuration(4000);
//alpha.setFillAfter(true);
//imageStartSplash.setAnimation(alpha);

It still show the error... Why is that happened ?

Some one can teach me how to fix it , it will save me form the world.

Thanks in advance.

asked 53 secs ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 22 ارديبهشت 1396 ساعت: 10:30

صفحه بندی