Displaying Splash screen only once on user preference

Displaying Splash screen only once on user preference

Content Index :

Displaying Splash screen only once on user preference
Tag : java , By : snapshooter
Date : November 28 2020, 09:01 AM

will help you no need to create a thread, just before starting your splash screen in your splash screen activity check shared pref value as-
public class Splash extends Activity {

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

/** Called when the activity is first created. */
public void onCreate(Bundle icicle) {

Button button = (Button) findViewById(R.id.button1);

        button.setOnClickListener(new OnClickListener() {


        public void onClick(View view) {

   SharedPreferences.Editor editor = getSharedPreferences(MY_PREFS_NAME,  MODE_PRIVATE).edit();
   editor.putString("status", "clicked");


  SharedPreferences prefs = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE); 

String name = prefs.getString("status", "NotClicked");

            /* Create an Intent that will start the Menu-Activity. */
            Intent mainIntent = new Intent(Splash.this,pnbActivity.class);
    /* New Handler to start the Menu-Activity 
     * and close this Splash-Screen after some seconds.*/
    new Handler().postDelayed(new Runnable(){
        public void run() {

            /* Create an Intent that will start the Menu-Activity. */
            Intent mainIntent = new Intent(Splash.this,pnbActivity.class);


No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Splash Screen start activity depending on preference?

Tag : android , By : kakashi_
Date : March 29 2020, 07:55 AM
should help you out I have a solution for the splash screen to be appear only at the first time of running the application by using the shared preferences. Try this,
public class Splash extends Activity {
    private long splashDelay = 1500;
    int counter;
    SharedPreferences app_preferences;

    public void onCreate(Bundle savedInstanceState) {

        app_preferences = PreferenceManager.getDefaultSharedPreferences(this);
        counter = app_preferences.getInt("counter", 1);
        System.out.println("count is..." + counter);

        TimerTask task = new TimerTask() {
            public void run() {
                if (counter == 1) {
                    Intent in = new Intent(Splash.this, Yourclass1.class);
                } else {
                    Intent intent = new Intent().setClass(Splash.this, Yourclass2.class);
                SharedPreferences.Editor editor = app_preferences.edit();
                editor.putInt("counter", +(counter + 1));



        Timer timer = new Timer();
        timer.schedule(task, splashDelay);

iPhone app: avoiding white screen after splash screen. Let splash screen linger, hide it after UIWebview loads? Splash s

Tag : ios , By : Felix Almeida
Date : March 29 2020, 07:55 AM
should help you out Here's a way to achieve it, get rid of all the code in your AppDelegate first of all. In your root view controller add an instance variable of class UIImageView called "splash".
Now in the rootViewController.m:
-(void) viewWillAppear:(BOOL) animated {

    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{

        self.view.userInteractionEnabled = NO;

        splash = [[UIImageView alloc] initWithFrame:[UIScreen mainScreen].bounds];

        splash.image = [UIImage imageNamed:@"Default.png"];
        [self.view addSubview:splash];
static dispatch_once_t onceToken;
        dispatch_once(&onceToken, ^{

          [splash removeFromSuperView];
-(void) viewDidLoad{

    CGRect webFrame = CGRectMake(0.0, 0.0, 320.0, 460.0);
    UIWebView *webView = [[UIWebView alloc] initWithFrame:webFrame];

    webView.delegate = self;

    [webView setBackgroundColor:[UIColor clearColor]];
    NSString *urlAddress = @"http://www.cnn.com";
    NSURL *url = [NSURL URLWithString:urlAddress];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    [webView loadRequest:requestObj];
-(void) webViewDidFinishLoad:(UIWebView *)webView {

    static dispatch_once_t onceToken;
        dispatch_once(&onceToken, ^{

          [splash removeFromSuperView];

Splash Screen not displaying in iPad but displaying on simulator

Tag : objective-c , By : Lord Zantor
Date : March 29 2020, 07:55 AM
it should still fix some issue All file names are case-sensitive.
rename them to : Default-Landscape.png & Default-Landscape@2x.png

Android : Set a preference's summary in a main preference screen to the values selected in a sub preference screen

Tag : android , By : ChaseVoid
Date : March 29 2020, 07:55 AM
To fix the issue you can do I have resolved this myself. It turned out to not be too complex.
In the "onResume" of the activity for the first preference screen, I simply call a utility method to generate the summary string for the preference whose summary is to contain the values of all selected values in the second screen. This utility method queries the stored preferences to get the preference values and then makes up a suitable string. As this utility method checks the values of the stored preference the summary will be accurate when you first go into the activity as well as when you return to the activity from the sub-screen.
// update the preference's summary to a string containing the values selected in the sub-screen
Preference syncPref = findPreference(SUB_SCREN_OF_SETTINGS);

public String getSubScreenSummary(){
    // get the value of list_pref_1
    // get the value of list_pref_2
    String s = ...... // build up the string based on values of list_pref_1/list_pref_2
    return s;

Cordova Splash screen preference name in config.XML

Tag : cordova , By : Blight
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • How to make a GitHub GraphQL API Call from Java
  • What's the difference between @ComponentScan and @Bean in a context configuration?
  • Expected class or package adding a view using a class
  • can be delete of a element in a static array be O(1)?
  • Instance variable heap or stack ? ( with specific example)
  • Assert progress of ProgressBar in Espresso test
  • How to detect if gson.fromjson() has excess elements
  • I cant generate the proper code to select the a specific filter on a BI dashboard I am working on
  • How to Inject Dependencies into a Servlet Filter with Spring Boot Filter Registration Bean?
  • Thrift types as a Generic
  • Effective algorithm to random 4 unique integers less than a big max such as 100_000
  • Combining or and negation in Java regex?
  • Unable to instantiate default tuplizer Exception
  • Multi-tenant migration to work with quarkus
  • Ignite persisting a Set: Cannot find metadata for object with compact footer
  • Maven cannot resolve Jacob dependency using eclipse
  • testcontainers oracle database container starts before database user is created
  • Launching two spring boot apps in integration test
  • Is there a way to add a HashMap's value that is a integer array into a ArrayList?
  • Is there any way that I can get a parameter in paintComponent?
  • Empty stack with one recursive method and one iterative method
  • What's the behavior of onBackpressureBuffer in RxJava2
  • Java regex can only use 1 quantifier in a lookback (need 2)
  • How to fix error in native query : it is showing syntax error near or at
  • How to retrieve nested object from a document and display it in FirestoreRecyclerOptions?
  • Why not use ListIterator for full LinkedList Operation?
  • Android Webview EvaluateJavascript sometimes does not return a response
  • Matcher java doesn't work but regex seems to be good
  • Finding dimensions of a .gif file
  • Java Number format how to change +/- sign to custom text
  • Entity partially saved when using JOINED inheritance strategy and setting spring.jpa.properties.hibernate.jdbc.batch_siz
  • Stored Procedure in Java Spring Boot Project returns null as Output
  • How to solve org.hibernate.MappingException which is causing due to inheriting a class
  • Clean Archtecture. Understanding of scheme
  • Processing 3 triangle not showing in Javafx 8 Window tab
  • How to specify a sequence-based generated value in Hibernate 5 via legacy mapping
  • Spring-boot application not getting auto-deployed on startup
  • How to only pass strings that the user select
  • Is there a way to SELECT using "GREATEST(field1, field2)" where field1 and field2 are aggregate sums in the sa
  • How to handle JSON objects wrapped into one JSON object with retrofit2?
  • Configure Hazelcast CPSubsystem Retries Timeout
  • how to use onBindViewHolder with multiple items in android RecyclerView
  • No ParameterResolver registered for parameter in BeforeAll method
  • Finding the path in a graph with the least casualties according to the lanchester square law
  • MongoWriteException when inserting into Mongodb with composite custom _id
  • Fetch Oracle procedure metadata with Java when multiple procedure signatures
  • Value modification of key-pair in HashMap and impact for a HashCode
  • Migration from solrj to spring-data-solr
  • How to check if you're still connected to the database with jpa
  • Use Date type in the graphql scheme
  • Split and add the string based on length
  • Is "main" method of spring boot application required when deploy as war
  • Getting the average within specific numbers in an array
  • how to use izpack to make my jar application to installer?
  • What is meant by src in Java Eclipse?
  • Create a mirrored linked list in Java
  • Examples of good JPA Java Desktop Application
  • Translate Java to Python -- signing strings with PEM certificate files
  • Algorithm Analysis tool for java
  • Java serial comm API - what does inputstream.read() return if a timeout occurs?
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com