安卓,从一个活动跳转到另一个活动出现已停止

图片说明
图片说明
图片说明
图片说明

调试该项目时,先关掉其他项目Close Project,然后打断点,按F6 Step Over进行调试,如果过程中跳入不认识的代码,就按F7 Step Return,直到跳
到你认识的代码
图片说明
解决办法:

 <activity
      android:name=".SecondActivity">
<intent-filter>
    <action android:name="com.example.activitytest.ACTION_START"/>
    <category
    android:name="android.intent.category.DEFAULT" />
    <category
        android:name="com.example.activitytest.MY_CATEGORY"/>
    </intent-filter>
 </activity>

        <activity
      android:name=".ThirdActivity">
<intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <category
    android:name="android.intent.category.DEFAULT" />
    <data android:scheme="http"/>
    </intent-filter>
 </activity>
 Intent inten=new Intent(Intent.ACTION_VIEW);
inten.setData(Uri.parse("http://m.baidu.com"));
startActivity(inten);

MainActivity.java

 package com.example.activitytest;


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

public class MainActivity extends Activity implements OnClickListener{
    Button but1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        but1=(Button)findViewById(R.id.bt1);
        but1.setOnClickListener(this );
        }



        public void onClick(View v)
        {
        switch (v.getId())
        {
        case R.id.bt1:

Intent intent=new Intent("com.example.activitytest.ACTION_START");
intent.addCategory("com.example.activitytest.MY_CATEGORY");
startActivity(intent);
        break;
        default:break;
        }
        }

    @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;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}

SecondActivity.java

 package com.example.activitytest;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.Button;

public class SecondActivity extends Activity implements OnClickListener{
    Button but2;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.second_layout);
        but2=(Button)findViewById(R.id.bt2);
        but2.setOnClickListener(this );
        }



        public void onClick(View v)
        {
        switch (v.getId())
        {
        case R.id.bt2:

Intent inten=new Intent(Intent.ACTION_VIEW);
inten.setData(Uri.parse("m.baidu.com"));
startActivity(inten);
        break;
        default:break;
        }
        }


}

ThirdActivity.java

 package com.example.activitytest;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;

public class ThirdActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.third_layout);
    }

}

AndroidManifest.xml

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.activitytest"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
      android:name=".SecondActivity">
<intent-filter>
    <action android:name="com.example.activitytest.ACTION_START"/>
    <category
    android:name="android.intent.category.DEFAULT" />
    </intent-filter>
 </activity>

        <activity
      android:name=".ThirdActivity">
<intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <category
    android:name="android.intent.category.DEFAULT" />
    <data android:scheme="http"/>
    </intent-filter>
 </activity>
    </application>

</manifest>

布局文件
activity_main.xml

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.activitytest.MainActivity" >

    <Button 
           android:layout_width="wrap_content"
           android:layout_height="wrap_content" 
           android:id="@+id/bt1"
           android:text="@string/bt1"/>
</RelativeLayout>

second_layout.xml

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <Button 
           android:layout_width="wrap_content"
           android:layout_height="wrap_content" 
           android:id="@+id/bt2"
           android:text="@string/bt2"/>


</LinearLayout>

third_layout.xml

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <Button 
           android:layout_width="wrap_content"
           android:layout_height="wrap_content" 
           android:id="@+id/bt3"
           android:text="@string/bt3"/>


</LinearLayout>

好像没看到 你想跳到那个acvitity的那句语句

com.example.activitytest.ACTION_START
ACTION_START这个是什么?