活动中出错,logcat中没有显示此类文件

时间:2013-03-09 02:32:38

标签: android

我做了一个活动,就像我做的通常活动一样,我没有错误,但是在我之前做的这个活动中,我在logcat中遇到了这个错误,这里是logcat:

这是我的活动:

package com.lspu.handbook;

import com.lspu.handbook.R;

import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.Toast;

public class bor extends Activity{

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
    WindowManager.LayoutParams.FLAG_FULLSCREEN);

    this.setContentView(R.layout.bor);

    StartAnimations();
}
     private void StartAnimations() {
            Animation anim = AnimationUtils.loadAnimation(this, R.anim.alpha);
            anim.reset();
            LinearLayout l=(LinearLayout) findViewById(R.id.lspulayout);
            l.clearAnimation();
            l.startAnimation(anim);


            //back button
            Button backButton = (Button)findViewById(R.id.lspu_bak_btn);
            backButton.setOnClickListener(new OnClickListener() {

                public void onClick(View v) {
                    Intent instructionsIntent = new Intent(bor.this,lspu.class);
                    startActivity(instructionsIntent);
                finish();
                }
             });
            }
     @Override
        public void onBackPressed() {
            moveTaskToBack(true);
        }
}

03-09 02:10:56.425: E/AndroidRuntime(766): FATAL EXCEPTION: main
03-09 02:10:56.425: E/AndroidRuntime(766): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.lspu.handbook/com.lspu.handbook.bor}: java.lang.NullPointerException
03-09 02:10:56.425: E/AndroidRuntime(766):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-09 02:10:56.425: E/AndroidRuntime(766):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-09 02:10:56.425: E/AndroidRuntime(766):  at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-09 02:10:56.425: E/AndroidRuntime(766):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-09 02:10:56.425: E/AndroidRuntime(766):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-09 02:10:56.425: E/AndroidRuntime(766):  at android.os.Looper.loop(Looper.java:137)
03-09 02:10:56.425: E/AndroidRuntime(766):  at android.app.ActivityThread.main(ActivityThread.java:5039)
03-09 02:10:56.425: E/AndroidRuntime(766):  at java.lang.reflect.Method.invokeNative(Native Method)
03-09 02:10:56.425: E/AndroidRuntime(766):  at java.lang.reflect.Method.invoke(Method.java:511)
03-09 02:10:56.425: E/AndroidRuntime(766):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-09 02:10:56.425: E/AndroidRuntime(766):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-09 02:10:56.425: E/AndroidRuntime(766):  at dalvik.system.NativeStart.main(Native Method)
03-09 02:10:56.425: E/AndroidRuntime(766): Caused by: java.lang.NullPointerException
03-09 02:10:56.425: E/AndroidRuntime(766):  at com.lspu.handbook.bor.StartAnimations(bor.java:43)
03-09 02:10:56.425: E/AndroidRuntime(766):  at com.lspu.handbook.bor.onCreate(bor.java:31)
03-09 02:10:56.425: E/AndroidRuntime(766):  at android.app.Activity.performCreate(Activity.java:5104)
03-09 02:10:56.425: E/AndroidRuntime(766):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-09 02:10:56.425: E/AndroidRuntime(766):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-09 02:10:56.425: E/AndroidRuntime(766):  ... 11 more
03-09 02:15:56.570: I/Process(766): Sending signal. PID: 766 SIG: 9
03-09 02:15:57.305: E/Trace(819): error opening trace file: No such file or directory (2)

任何人都知道错误是什么?

先谢谢你们!

0 个答案:

没有答案