打开超过1个意图(活动)

时间:2011-05-12 20:30:15

标签: android

我创建了2个活动。它强行关闭。为什么?

05-12 23:26:07.041: ERROR/AndroidRuntime(5170): Uncaught handler: thread main exiting due to uncaught exception
05-12 23:26:07.051: ERROR/AndroidRuntime(5170): java.lang.VerifyError: yaraby.y.yaraby$1
05-12 23:26:07.051: ERROR/AndroidRuntime(5170):     at yaraby.y.yaraby.onCreate(yaraby.java:44)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1127)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170):     at android.app.ActivityThread.access$1800(ActivityThread.java:112)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170):     at android.os.Looper.loop(Looper.java:123)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170):     at android.app.ActivityThread.main(ActivityThread.java:3948)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170):     at java.lang.reflect.Method.invokeNative(Native Method)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170):     at  java.lang.reflect.Method.invoke(Method.java:521)
05-12 23:26:07.051: ERROR/AndroidRuntime(5170):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
 05-12 23:26:07.051: ERROR/AndroidRuntime(5170):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
 05-12 23:26:07.051: ERROR/AndroidRuntime(5170):     at dalvik.system.NativeStart.main(Native Method)

如果有人有解决方案,请告诉我,我可以发送我的项目代码进行检查

 public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    inputfld=(EditText)findViewById(R.id.input);
    Text=(TextView)findViewById(R.id.view);
    Enter=(Button)findViewById(R.id.enter);
    Connect=(Button)findViewById(R.id.connect);

    Text.append( "\n about to create a socket");    


    txt=(EditText)findViewById(R.id.txt);
    next = (Button) findViewById(R.id.Button01);   

    next.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent i = new Intent(yaraby.this, HelloItemizedOverlay.class);
 yaraby.this.startActivity(i);
//              Toast.makeText(getApplicationContext(), "haaaaaaaaaaa",Toast.LENGTH_LONG).show();
        }
    });

这是头等的第一个Oncreate

public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main2);

    Button next = (Button) findViewById(R.id.Button02);
    next.setOnClickListener(new View.OnClickListener() {
    private String key;

    public void onClick(View view) {
        next.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            Intent i = new Intent(yaraby.this,     HelloItemizedOverlay.class);
            yaraby.this.startActivity(i);

  next.setOnClickListener(new OnClickListener() { is the 44 line !! 

0 个答案:

没有答案