Making software AS

SplashScreen.java
package project.;

import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;

/**
* Created by hp on 2/10/2018.
*/

public class SplashScreen extends AppCompatActivity {

/** Duration of wait **/
private final int SPLASH_DISPLAY_LENGTH = 2000;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.splashscreen);

/* New Handler to start the Menu-Activity
* and close this Splash-Screen after some seconds.*/
new Handler().postDelayed(new Runnable(){
@Override
public void run() {
/* Create an Intent that will start the Menu-Activity. */
startActivity(new Intent(SplashScreen.this, LoginActivity.class));
finish();
}
}, SPLASH_DISPLAY_LENGTH);
}

}


ViewPagerAdapter.java

package project.;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

/**
* Created by hp on 2/9/2018.
*/

public class ViewPagerAdapter extends FragmentPagerAdapter {

public ViewPagerAdapter(FragmentManager fm) {
super(fm);
}

@Override
public Fragment getItem(int position) {
if (position ==0) {
return new CategoryFragment();
} else return new CategoryFragment();
}

@Override
public int getCount() {
return 2;
}
}

Leave a comment