Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

program not working after splash screen in android

i have made a simple android for splash demo ,in that two activities are there but after splash screen program stopped running...please help me for it..

my code:

splash.java

package com.esp.therisemethod.ui;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.esp.therisemethod.R;
import com.esp.therisemethod.util.Log;

public class SplashActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        Thread splashThread = new Thread() {
            public void run() {
                try {
                    sleep(2000);
                } catch (InterruptedException e) {
                    Log.error(this.getClass() + "::: OnCreate Thread :::", e);
                }

                Intent intent = null;
                intent = new Intent(SplashActivity.this, Registration.class);
                startActivity(intent);
                finish();
            }
        };
        splashThread.start();

    }

}

registration.java

package com.esp.therisemethod.ui;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.esp.therisemethod.R;
import com.esp.therisemethod.uc.Header;

public class Registration extends Activity implements OnClickListener{
    Button bt_login,bt_Reg;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_registration);
        bt_login =(Button)findViewById(R.id.bt_login);
        bt_Reg=(Button)findViewById(R.id.bt_reg);


    }
    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        switch (v.getId()) {
        case R.id.bt_login:

            break;

        case R.id.bt_reg:

            break;
        }
    }

}

Logcat

06-26 06:09:22.635: E/Trace(2371): error opening trace file: No such file or directory (2)
06-26 06:09:23.055: D/dalvikvm(2371): GC_FOR_ALLOC freed 34K, 7% free 2408K/2588K, paused 45ms, total 51ms
06-26 06:09:23.096: I/dalvikvm-heap(2371): Grow heap (frag case) to 5.264MB for 2908176-byte allocation
06-26 06:09:23.155: D/dalvikvm(2371): GC_FOR_ALLOC freed 1K, 4% free 5247K/5432K, paused 50ms, total 50ms
06-26 06:09:23.225: D/dalvikvm(2371): GC_CONCURRENT freed <1K, 4% free 5246K/5432K, paused 9ms+15ms, total 74ms
06-26 06:09:23.597: D/dalvikvm(2371): GC_FOR_ALLOC freed <1K, 4% free 5246K/5432K, paused 30ms, total 30ms
06-26 06:09:23.615: I/dalvikvm-heap(2371): Grow heap (frag case) to 6.497MB for 1292972-byte allocation
06-26 06:09:23.755: D/dalvikvm(2371): GC_CONCURRENT freed 0K, 3% free 6509K/6696K, paused 74ms+15ms, total 142ms
06-26 06:09:24.025: D/gralloc_goldfish(2371): Emulator without GPU emulation detected.
06-26 06:09:26.375: D/AndroidRuntime(2371): Shutting down VM
06-26 06:09:26.395: W/dalvikvm(2371): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
06-26 06:09:26.905: E/AndroidRuntime(2371): FATAL EXCEPTION: main
06-26 06:09:26.905: E/AndroidRuntime(2371): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.esp.therisemethod/com.esp.therisemethod.ui.Registration}: android.view.InflateException: Binary XML file line #7: Error inflating class com.esp.therisemethod.uc.Header
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.os.Looper.loop(Looper.java:137)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.app.ActivityThread.main(ActivityThread.java:5041)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at java.lang.reflect.Method.invokeNative(Native Method)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at java.lang.reflect.Method.invoke(Method.java:511)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at dalvik.system.NativeStart.main(Native Method)
06-26 06:09:26.905: E/AndroidRuntime(2371): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class com.esp.therisemethod.uc.Header
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.view.LayoutInflater.createView(LayoutInflater.java:613)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.app.Activity.setContentView(Activity.java:1881)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at com.esp.therisemethod.ui.Registration.onCreate(Registration.java:19)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.app.Activity.performCreate(Activity.java:5104)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
06-26 06:09:26.905: E/AndroidRuntime(2371):     ... 11 more
06-26 06:09:26.905: E/AndroidRuntime(2371): Caused by: java.lang.reflect.InvocationTargetException
06-26 06:09:26.905: E/AndroidRuntime(2371):     at java.lang.reflect.Constructor.constructNative(Native Method)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.view.LayoutInflater.createView(LayoutInflater.java:587)
06-26 06:09:26.905: E/AndroidRuntime(2371):     ... 22 more
06-26 06:09:26.905: E/AndroidRuntime(2371): Caused by: android.view.InflateException: Binary XML file line #19: Error inflating class com.esp.therisemethod.uc.EspTextView
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.view.LayoutInflater.createView(LayoutInflater.java:613)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at com.esp.therisemethod.uc.Header.<init>(Header.java:21)
06-26 06:09:26.905: E/AndroidRuntime(2371):     ... 25 more
06-26 06:09:26.905: E/AndroidRuntime(2371): Caused by: java.lang.reflect.InvocationTargetException
06-26 06:09:26.905: E/AndroidRuntime(2371):     at java.lang.reflect.Constructor.constructNative(Native Method)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.view.LayoutInflater.createView(LayoutInflater.java:587)
06-26 06:09:26.905: E/AndroidRuntime(2371):     ... 31 more
06-26 06:09:26.905: E/AndroidRuntime(2371): Caused by: java.lang.RuntimeException: native typeface cannot be made
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.graphics.Typeface.<init>(Typeface.java:175)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at android.graphics.Typeface.createFromAsset(Typeface.java:149)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at com.esp.therisemethod.util.Utils.getFont(Utils.java:389)
06-26 06:09:26.905: E/AndroidRuntime(2371):     at com.esp.therisemethod.uc.EspTextView.<init>(EspTextView.java:23)
06-26 06:09:26.905: E/AndroidRuntime(2371):     ... 34 more

please help me...thanx in advance

like image 861
jigar Avatar asked Dec 01 '22 21:12

jigar


1 Answers

Use this as your SplashActivity... It worked in my case

public class SplashActivity extends Activity {
    Intent intent;

    //Called when activity if first called
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
            setContentView(R.layout.splash_screen);

         intent = new Intent(this, HomeActivity.class);
        Handler handler = new Handler();

        handler.postDelayed(new Runnable() {
            public void run() {

                startActivity(intent);
                finish();
            }
        }, 2000);

    }
like image 110
Amresh Avatar answered Dec 06 '22 00:12

Amresh