Java tutorial
package edu.uwp.alga; /** * Copyright 2015 UW-Parkside, Harleen Kaur, Hanh Le, Francisco Mateo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import android.annotation.TargetApi; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.view.Window; import android.view.WindowManager; public class SplashActivity extends AppCompatActivity { @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); //set status bar color if (Build.VERSION.SDK_INT >= 21) { // Call some material design APIs here Window window = this.getWindow(); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.setStatusBarColor(ContextCompat.getColor(this, R.color.WBackground)); } /*Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.spash); ImageView image = (ImageView)findViewById(R.id.image_splash); if(bitmap.getHeight()>=2048||bitmap.getWidth()>=2048){ DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int width = metrics.widthPixels; int height = metrics.heightPixels; bitmap = Bitmap.createScaledBitmap(bitmap, width, height, true); } image.setImageBitmap(bitmap);*/ new Handler().postDelayed(() -> { startActivity(new Intent(SplashActivity.this, MainActivity.class)); finish(); }, 1500); } }