Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6644477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:10:18+00:00 2026-05-26T00:10:18+00:00

In My application, I am using thread to show the splash screen. . .

  • 0

In My application, I am using thread to show the splash screen. . .
But i have also given the Android Licensing to My Application. Which also uses the thread. . .
But While i am installing the Application it runs once..
if i again open it then it got crash. where is the problem ???
the code is as below :

   package com.EMTPrep.Paramedic.app;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings.Secure;
import android.view.Window;
import com.android.vending.licensing.AESObfuscator;
import com.android.vending.licensing.LicenseChecker;
import com.android.vending.licensing.LicenseCheckerCallback;
import com.android.vending.licensing.ServerManagedPolicy;
import com.EMTPrep.Paramedic.app.R;

public class SplashActivity extends Activity 
{

    private static boolean DEBUG = false;
    private static int DURATION;
    private Handler splashHandler;
    private Runnable launcherRunnable;

     private LicenseCheckerCallback mLicenseCheckerCallback;// for the License
     private LicenseChecker mChecker;// for the License
     // === A handler on the UI thread.
     private Handler mHandler;

     private static final String BASE64_PUBLIC_KEY = "I have puted the Licensing code here";//// for the License
     // === Generate your own 20 random bytes, and put them here.
     private static final byte[] SALT = new byte[] 
                {
            -46, 65, 90, -128, -13, -57, 74, -64, 51, 66, -85, -67, 89, -114, -36, 113, 77, 32, -64,
            89
        }; // for the License

    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.splash);

         mHandler = new Handler();

        // Try to use more data here. ANDROID_ID is a single point of attack.
        String deviceId = Secure.getString(getContentResolver(), Secure.ANDROID_ID);// for the License
        // === Library calls this when it's done.
        mLicenseCheckerCallback = new MyLicenseCheckerCallback();// for the License
        // === Construct the LicenseChecker with a policy.
        mChecker = new LicenseChecker(this, new ServerManagedPolicy(this,new AESObfuscator(SALT, getPackageName(), deviceId)),// for the License
                BASE64_PUBLIC_KEY);// for the License
        doCheck();// for the License


        DURATION = Integer.valueOf(getString(R.string.splash_duration));

        splashHandler = new Handler();

//  ================ Main Code of the Application

//      launcherRunnable = new Runnable() {
//          @Override
//          public void run() {
//              Intent i = new Intent(SplashActivity.this, MainMenuActivity.class);
//              i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
//              startActivity(i);
//              SplashActivity.this.finish();
//          }
//      };
//      if (DEBUG)
//      {
//          splashHandler.post(launcherRunnable);
//      }
//      else
//          splashHandler.postDelayed(launcherRunnable, DURATION);
//

    }
    protected Dialog onCreateDialog(int id) //// for the License 
    {
        // We have only one dialog.
        return new AlertDialog.Builder(this)
            .setTitle(R.string.unlicensed_dialog_title)
            .setMessage(R.string.unlicensed_dialog_body)
            .setPositiveButton(R.string.buy_button, new DialogInterface.OnClickListener() 
            {
                public void onClick(DialogInterface dialog, int which) 
                {
                    Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
                        "http://market.android.com/details?id=" + getPackageName()));
                    startActivity(marketIntent);
                }
            })
            .setNegativeButton(R.string.quit_button, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    finish();
                }
            })
            .create();
    }

    private void displayResult(final String result) { // for the License
        mHandler.post(new Runnable() {
            public void run() {
               // mStatusText.setText(result);
                setProgressBarIndeterminateVisibility(false);
                //mCheckLicenseButton.setEnabled(true);
            }
        });
    }

    private class MyLicenseCheckerCallback implements LicenseCheckerCallback // for the License 
    {        
        public void allow() 
        {            
            if (isFinishing()) 
            {                
                // Don't update UI if Activity is finishing.                
                return;            
            }            
            // Should allow user access.  

            launcherRunnable = new Runnable() 
            {
                @Override
                public void run() 
                {
                    Intent i = new Intent(SplashActivity.this, MainMenuActivity.class);
                    i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    startActivity(i);
                    SplashActivity.this.finish();
                }
            };

            if (DEBUG)
            {
                splashHandler.post(launcherRunnable);
            }
            else
                splashHandler.postDelayed(launcherRunnable, DURATION);

            displayResult(getString(R.string.allow));        
        }        
        public void dontAllow() 
        {            
            if (isFinishing()) 
            {                
                // Don't update UI if Activity is finishing.                
                return;            
            }            

            displayResult(getString(R.string.dont_allow));            

            // Should not allow access. An app can handle as needed,            
            // typically by informing the user that the app is not licensed            
            // and then shutting down the app or limiting the user to a            
            // restricted set of features.            
            // In this example, we show a dialog that takes the user to Market.            
            showDialog(0);        
        }

         public void applicationError(ApplicationErrorCode errorCode) 
            {
                if (isFinishing()) 
                {
                    // Don't update UI if Activity is finishing.
                    return;
                }
                // This is a polite way of saying the developer made a mistake
                // while setting up or calling the license checker library.
                // Please examine the error code and fix the error.
                String result = String.format(getString(R.string.application_error), errorCode);
                displayResult(result);
            }

    }
     private void doCheck()// for the License 
        {
            //mCheckLicenseButton.setEnabled(false);
            setProgressBarIndeterminateVisibility(true);
            //mStatusText.setText(R.string.checking_license);
            mChecker.checkAccess(mLicenseCheckerCallback);
        }
     @Override // for the License
        protected void onDestroy() {
            super.onDestroy();
            mChecker.onDestroy();
        }
}

I think there might be the problem in thread. . . Please help me to solve it. . Thanks
Please help me in this. . .
And let me tell while i am able to run the application only at once. . .
Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:10:19+00:00Added an answer on May 26, 2026 at 12:10 am

    Can you try splashHandler.postDelayed(new Runnable(), DURATION); ?

    and put it up to fields private Handler splashHandler = new Handler();

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using thread which will receive messages from the external application.So my thread
Currently, I am showing splash screen in my desktop application using the following way
I have a WPF application in which a thread checks some value. In certain
I have my application in which in three datagridview independently in three thread load
I am using a splash screen for a c# which runs on startup and
I have a multi threaded client server application which uses Sockets. When a new
I have an application that uses disabled JTextFields in several places which are intended
In my android application i am using a loading screen,processed by Async task.In do
i am using a java thread to update jlabel text value in my application
Our application follows the approach of maintaining a DataContext per Thread/HttpContext, using the DataContextFactory

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.