E / Trace(20657):错误打开跟踪文件:没有这样的文件或目录(2)

时间:2014-04-02 11:58:53

标签: java android eclipse android-intent

我的应用程序运行良好,但突然间它甚至停止启动。 这是logcat

04-02 17:11:00.234: E/Trace(732): error opening trace file: No such file or directory (2)
04-02 17:11:02.005: D/AndroidRuntime(732): Shutting down VM
04-02 17:11:02.005: W/dalvikvm(732): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
04-02 17:11:02.024: E/AndroidRuntime(732): FATAL EXCEPTION: main
04-02 17:11:02.024: E/AndroidRuntime(732): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.tracker/com.example.tracker.MainActivity}: java.lang.NullPointerException
04-02 17:11:02.024: E/AndroidRuntime(732):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
04-02 17:11:02.024: E/AndroidRuntime(732):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
04-02 17:11:02.024: E/AndroidRuntime(732):  at android.app.ActivityThread.access$600(ActivityThread.java:130)
04-02 17:11:02.024: E/AndroidRuntime(732):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
04-02 17:11:02.024: E/AndroidRuntime(732):  at android.os.Handler.dispatchMessage(Handler.java:99)

和我的主要java

package com.example.tracker;

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

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Button inbus=(Button) findViewById(R.id.button1);
        Button inbay=(Button) findViewById(R.id.button2);

        inbus.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View arg0) {
                // TODO Auto-generated method stub
                startActivity(new Intent(MainActivity.this,Inbus.class));
                        }
        });

        inbay.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
            startActivity(new Intent(MainActivity.this, Inbay.class));  
            }
        });
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

}

0 个答案:

没有答案