title: How can i implement an intro slider before the splash screen first time?
body: <p>Manifest file</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="demo.com.xapp"&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:roundIcon="@mipmap/ic_launcher_round"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
          &lt;activity android:name=".IntroActivity"&gt;&lt;/activity&gt;
          &lt;activity android:name=".SplashActivity"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity android:name=".MainActivity"&gt;&lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>Intro sliders Activity</p>
  
  <pre><code>public class IntroActivity extends AppCompatActivity {
  
      private ViewPager screenPager;
      IntroViewPagerAdapter introViewPagerAdapter ;
      TabLayout tabIndicator;
      Button btnNext;
      int position = 0 ;
      Button btnGetStarted;
      Animation btnAnim ;
      TextView tvSkip;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          // make the activity on full screen
  
          requestWindowFeature(Window.FEATURE_NO_TITLE);
          getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                  WindowManager.LayoutParams.FLAG_FULLSCREEN);
  
  
          // when this activity is about to be launch we need to check if its openened before or not
  
          if (restorePrefData()) {
  
              Intent mainActivity = new Intent(getApplicationContext(),SplashActivity.class );
              startActivity(mainActivity);
              finish();
  
  
          }
  
          setContentView(R.layout.activity_intro);
  
          // hide the action bar
  
          getSupportActionBar().hide();
  
          // ini views
          btnNext = findViewById(R.id.btn_next);
          btnGetStarted = findViewById(R.id.btn_get_started);
          tabIndicator = findViewById(R.id.tab_indicator);
          btnAnim = AnimationUtils.loadAnimation(getApplicationContext(),R.anim.button_animation);
          tvSkip = findViewById(R.id.tv_skip);
  
          // fill list screen
  
          final List&lt;ScreenItem&gt; mList = new ArrayList&lt;&gt;();
          mList.add(new ScreenItem("Fresh Food","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua, consectetur  consectetur adipiscing elit",R.drawable.img1));
          mList.add(new ScreenItem("Fast Delivery","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua, consectetur  consectetur adipiscing elit",R.drawable.img2));
          mList.add(new ScreenItem("Easy Payment","Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua, consectetur  consectetur adipiscing elit",R.drawable.img3));
  
          // setup viewpager
          screenPager =findViewById(R.id.screen_viewpager);
          introViewPagerAdapter = new IntroViewPagerAdapter(this,mList);
          screenPager.setAdapter(introViewPagerAdapter);
  
          // setup tablayout with viewpager
  
          tabIndicator.setupWithViewPager(screenPager);
  
          // next button click Listner
  
          btnNext.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  position = screenPager.getCurrentItem();
                  if (position &lt; mList.size()) {
  
                      position++;
                      screenPager.setCurrentItem(position);
  
  
                  }
  
                  if (position == mList.size()-1) { // when we rech to the last screen
  
                      // TODO : show the GETSTARTED Button and hide the indicator and the next button
  
                      loaddLastScreen();
  
  
                  }
  
  
  
              }
          });
  
          // tablayout add change listener
  
  
          tabIndicator.addOnTabSelectedListener(new TabLayout.BaseOnTabSelectedListener() {
              @Override
              public void onTabSelected(TabLayout.Tab tab) {
  
                  if (tab.getPosition() == mList.size()-1) {
  
                      loaddLastScreen();
  
                  }
  
  
              }
  
              @Override
              public void onTabUnselected(TabLayout.Tab tab) {
  
              }
  
              @Override
              public void onTabReselected(TabLayout.Tab tab) {
  
              }
          });
  
  
  
          // Get Started button click listener
  
          btnGetStarted.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
  
                  //open main activity
  
                  Intent mainActivity = new Intent(getApplicationContext(),SplashActivity.class);
                  startActivity(mainActivity);
                  // also we need to save a boolean value to storage so next time when the user run the app
                  // we could know that he is already checked the intro screen activity
                  // i'm going to use shared preferences to that process
                  savePrefsData();
                  finish();
  
  
  
              }
          });
  
          // skip button click listener
  
          tvSkip.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  screenPager.setCurrentItem(mList.size());
              }
          });
  
  
  
      }
  
      private boolean restorePrefData() {
  
  
          SharedPreferences pref = getApplicationContext().getSharedPreferences("myPrefs",MODE_PRIVATE);
          Boolean isIntroActivityOpnendBefore = pref.getBoolean("isIntroOpnend",false);
          return  isIntroActivityOpnendBefore;
  
  
  
      }
  
      private void savePrefsData() {
  
          SharedPreferences pref = getApplicationContext().getSharedPreferences("myPrefs",MODE_PRIVATE);
          SharedPreferences.Editor editor = pref.edit();
          editor.putBoolean("isIntroOpnend",true);
          editor.commit();
  
  
      }
  
      // show the GETSTARTED Button and hide the indicator and the next button
      private void loaddLastScreen() {
  
          btnNext.setVisibility(View.INVISIBLE);
          btnGetStarted.setVisibility(View.VISIBLE);
          tvSkip.setVisibility(View.INVISIBLE);
          tabIndicator.setVisibility(View.INVISIBLE);
          // TODO : ADD an animation the getstarted button
          // setup animation
          btnGetStarted.setAnimation(btnAnim);
  
  
  
      }
  }
  </code></pre>
  
  <p>IntroViewPagerAdapter activity-</p>
  
  <pre><code>public class IntroViewPagerAdapter extends PagerAdapter {
  
      Context mContext;
      List&lt;ScreenItem&gt; mListScreen;
  
      public IntroViewPagerAdapter(Context mContext, List&lt;ScreenItem&gt; mListScreen) {
          this.mContext = mContext;
          this.mListScreen = mListScreen;
      }
  
      @NonNull
      @Override
      public Object instantiateItem(@NonNull ViewGroup container, int position) {
          LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          View layoutScreen = inflater.inflate(R.layout.layout_screen,null);
  
          ImageView imgSlide = layoutScreen.findViewById(R.id.intro_img);
          TextView title = layoutScreen.findViewById(R.id.intro_title);
          TextView description = layoutScreen.findViewById(R.id.intro_description);
  
          title.setText(mListScreen.get(position).getTitle());
          description.setText(mListScreen.get(position).getDescription());
          imgSlide.setImageResource(mListScreen.get(position).getScreenImg());
  
          container.addView(layoutScreen);
  
          return layoutScreen;
      }
  
      @Override
      public int getCount() {
          return mListScreen.size();
      }
  
      @Override
      public boolean isViewFromObject(@NonNull View view, @NonNull Object o) {
          return view == o;
      }
  
      @Override
      public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
          container.removeView((View)object);
      }
  }
  </code></pre>
  
  <p>Screen Item Activity-</p>
  
  <pre><code>public class ScreenItem {
      String Title, Description;
      int ScreenImg;
  
      public ScreenItem(String title, String description, int screenImg) {
          Title = title;
          Description = description;
          ScreenImg = screenImg;
      }
  
      public void setTitle(String title) {
          Title = title;
      }
  
      public void setDescription(String description) {
          Description = description;
      }
  
      public void setScreenImg(int screenImg) {
          ScreenImg = screenImg;
      }
  
      public String getTitle() {
          return Title;
      }
  
      public String getDescription() {
          return Description;
      }
  
      public int getScreenImg() {
          return ScreenImg;
      }
  }
  </code></pre>
  
  <p>Splash Screen Activity- </p>
  
  <pre><code>public class SplashActivity extends AppCompatActivity {
  
          public void onAttachedToWindow() {
              super.onAttachedToWindow();
              Window window = getWindow();
              window.setFormat(PixelFormat.RGBA_8888);
          }
          /** Called when the activity is first created. */
          Thread splashTread;
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              setContentView(R.layout.activity_splash);
              StartAnimations();
          }
          private void StartAnimations() {
              Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha);
              anim.reset();
              LinearLayout l=(LinearLayout) findViewById(R.id.lin_lay);
              l.clearAnimation();
              l.startAnimation(anim);
  
              anim = AnimationUtils.loadAnimation(this, R.anim.translate);
              anim.reset();
              TextView iv = (TextView) findViewById(R.id.splash);
              iv.clearAnimation();
              iv.startAnimation(anim);
  
              splashTread = new Thread() {
                  @Override
                  public void run() {
                      try {
                          int waited = 0;
                          // Splash screen pause time
                          while (waited &lt; 6000) {
                              sleep(100);
                              waited += 100;
                          }
                          Intent intent = new Intent(SplashActivity.this,
                                  MainActivity.class);
                          intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
                          startActivity(intent);
                          SplashActivity.this.finish();
                      } catch (InterruptedException e) {
                          // do nothing
                      } finally {
                          SplashActivity.this.finish();
                      }
  
                  }
              };
              splashTread.start();
  
          }
  
      }
  </code></pre>
  
  <p><em>how can we show Intro sliders before the splash screen on the first time when the app installed. Second time only splash screen shows not the intro sliders. I am new to android please help me to solve this problem.</em></p>