how to show another activity from splash screen using OOP not thread
===

here is my idea I want to create a component like activity in android so in this way I want to my main activity derived from my splash activity which is dervied from Activity and in my splash activity I want to check for a license and if it was available then I want to redirect to the main activity that has derived from splash activity.

My whole idea is having a component so by extending it from main activity everything should be automated.


I have done this use following code but it is not working smoothly and I'm sure there is something wrong with my approach:

    //my main activity which will be shown after splash screen
    public class MyActivity extends SplashLoader
    {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.setNextActivity(this);
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            TextView tv = (TextView) findViewById(R.id.tv);
            tv.setText("hello");
    
        }
    }
    
    //my splash activity
    
    public class SplashLoader extends Activity
    {
        private static final String ERROR_MESSAGE = "Error message";
        private  Activity nextActivity=null;
    
        public Activity getNextActivity() {
            return nextActivity;
        }
    
        public void setNextActivity(Activity nextActivity) {
            this.nextActivity = nextActivity;
        }
    
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            LinearLayout lLayout = new LinearLayout(this);
            lLayout.setOrientation(LinearLayout.VERTICAL);
            lLayout.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
            ImageView iv = new ImageView(this);
            iv.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
            iv.setImageResource(R.drawable.logo);
            lLayout.addView(iv);
            setContentView(lLayout);
    
    boolean isRegistered = false;
            if(!isRegistered)
            {
                createDialog().show();
            }
            else
            {
            //    finish();
                Intent intent = new Intent(SplashLoader.this,getNextActivity().getClass());
                startActivity(intent);
    
            }
        }
    
    
    
        private AlertDialog.Builder createDialog()
        {
            AlertDialog.Builder builder = new AlertDialog.Builder(this);
    
    
            DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialogInterface, int which)
                {
                    switch (which)
                    {
                        case DialogInterface.BUTTON_NEUTRAL:
                            System.exit(0);
                            break;
                        default:
                            break;
                    }
    
                }
            } ;
    
            builder.setMessage(ERROR_MESSAGE).setNeutralButton("Ok" ,clickListener );
            return builder;
        }
    }
    
    //and my manifest 
    
    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
              package="com.example"
              android:versionCode="1"
              android:versionName="1.0">
        <uses-sdk android:minSdkVersion="10"/>
        <uses-permission android:name="android.permission.INTERNET"/>
        <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    
        <application android:label="@string/app_name">
            <activity android:name="MyActivity"
                      android:label="@string/app_name">
                <intent-filter>
                    <action android:name="android.intent.action.MAIN"/>
                    <category android:name="android.intent.category.LAUNCHER"/>
                </intent-filter>
            </activity>
        </application>

</manifest> 


