Your needs are a pop-up screen. Here is my screensaver code.
Just add a new activity and install the application to open this operation.
public class SplashActivity extends DeviceInfoAbstractActivity {
@SuppressLint("MissingSuperCall") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState, R.layout.activity_splash); passScreen(); } private void passScreen() { new CountDownTimer(1000, 2000) { @Override public void onTick(long millisUntilFinished) { } @Override public void onFinish() { Intent intent = RDAIntentHelpers.getClearCacheIntent(); intent.setClass(SplashActivity.this, MainActivity.class); startActivity(intent); } }.start(); } @Override public void onBackPressed() {
and this getClearCacheIntent () method
public static Intent getClearCacheIntent() { Intent intent = new Intent(); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); return intent; }
After that, your splash screen will remain on the screen for 2 seconds. Do whatever you want =)
Arda
source share