开发者社区> 问答> 正文

android.content.ActivityNotFoundExceptio?400报错

android.content.ActivityNotFoundException: No Activity found to handle Intent? 400 报错

log:

12-07 14:35:20.541: I/System.out(272): 1:00
12-07 14:35:20.561: D/AndroidRuntime(272): Shutting down VM
12-07 14:35:20.561: W/dalvikvm(272): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
12-07 14:35:20.581: E/AndroidRuntime(272): FATAL EXCEPTION: main
12-07 14:35:20.581: E/AndroidRuntime(272): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.iStudy.Studying (has extras) }
12-07 14:35:20.581: E/AndroidRuntime(272): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1408)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.app.Activity.startActivityForResult(Activity.java:2817)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.app.Activity.startActivity(Activity.java:2923)
12-07 14:35:20.581: E/AndroidRuntime(272): at com.iStudy.Study.Main$1.onClick(Main.java:77)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.view.View.performClick(View.java:2408)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.view.View$PerformClick.run(View.java:8816)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.os.Handler.handleCallback(Handler.java:587)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.os.Handler.dispatchMessage(Handler.java:92)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.os.Looper.loop(Looper.java:123)
12-07 14:35:20.581: E/AndroidRuntime(272): at android.app.ActivityThread.main(ActivityThread.java:4627)
12-07 14:35:20.581: E/AndroidRuntime(272): at java.lang.reflect.Method.invokeNative(Native Method)
12-07 14:35:20.581: E/AndroidRuntime(272): at java.lang.reflect.Method.invoke(Method.java:521)
12-07 14:35:20.581: E/AndroidRuntime(272): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-07 14:35:20.581: E/AndroidRuntime(272): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-07 14:35:20.581: E/AndroidRuntime(272): at dalvik.system.NativeStart.main(Native Method)

MainFest:


<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.iStudy.Study"
    android:versionCode="1"
    android:versionName="0.1 beta" >
    <uses-sdk android:minSdkVersion="8" 
        android:targetSdkVersion="17"/>
        <application android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/AppName" >
        <activity android:name=".Main">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        
        <activity android:name=".Studying"
            android:exported="false">
            <intent-filter>
                <action android:name="com.iStudy.Study.Studying" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>       
    </application>
</manifest>

出错的JAVA文件:

package com.iStudy.Study;

import java.util.ArrayList;
import java.util.Timer;
import java.util.TimerTask;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.Window;
import android.widget.TextView;

public class Studying extends Activity{

	static int minute = -1;
	static int second = -1;
	
	final static String tag = "tag";
	
	TextView timeview;
	Timer timer;
	TimerTask  timertask;
	
	Handler handler = new Handler(){
		public void handleMessage(Message msg) {
			System.out.println("Handle!");
			
			if (minute == 0) {
				if (second == 0) {
					timeview.setText("学习成功!");
					if (timer != null) {
						timer.cancel();
						timer = null;
					}
					if (timertask != null) {
						timertask = null;
					}
				}else {
					second--;
					if (second >= 10) {
						timeview.setText("0"+minute + ":" + second);
					}else {
						timeview.setText("0"+minute + ":0" + second);
					}
				}
			}else {
				if (second == 0) {
					second =59;
					minute--;
					if (minute >= 10) {
						timeview.setText(minute + ":" + second);
					}else {
						timeview.setText("0"+minute + ":" + second);
					}
				}else {
					second--;
					if (second >= 10) {
						if (minute >= 10) {
							timeview.setText(minute + ":" + second);
						}else {
							timeview.setText("0"+minute + ":" + second);
						}
					}else {
						if (minute >= 10) {
							timeview.setText(minute + ":0" + second);
						}else {
							timeview.setText("0"+minute + ":0" + second);
						}
					}
				}
			}
		};
	};
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		Log.v(tag, "log---------->onCreate!");
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		setContentView(R.layout.studying);
		timeview = (TextView)findViewById(R.id.Time);
		
		if (minute == -1 && second == -1) {
			Intent intent = getIntent();
			ArrayList<Integer> times = intent.getIntegerArrayListExtra("times");
			minute = times.get(0);
			second = times.get(1);
		}
		
		timeview.setText(minute + ":" + second);
		
		timertask = new TimerTask() {
			@Override
			public void run() {
				Message msg = new Message();
				msg.what = 0;
				handler.sendMessage(msg);
			}
		};
		
		timer = new Timer();
		timer.schedule(timertask,0,1000);
		
	}
	
	@Override
	protected void onDestroy() {
		Log.v(tag, "log---------->onDestroy!");
		if (timer != null) {
			timer.cancel();
			timer = null;
		}
		if (timertask != null) {
			timertask = null;
		}
		minute = -1;
		second = -1;
		super.onDestroy();
	}
	
	@Override
	protected void onStart() {
		Log.v(tag, "log---------->onStart!");
		super.onStart();
	}
	
	@Override
	protected void onStop() {
		Log.v(tag, "log---------->onStop!");
		super.onStop();
	}

	@Override
	protected void onResume() {
		Log.v(tag, "log---------->onResume!");
		super.onResume();
	}
	
	@Override
	protected void onRestart() {
		Log.v(tag, "log---------->onRestart!");
		super.onRestart();
	}
	
	@Override
	protected void onPause() {
		Log.v(tag, "log---------->onPause!");
		super.onPause();
	}
	
}
源码下载地址: http://www.kuaipan.cn/file/id_47491729724613150.htm

展开
收起
爱吃鱼的程序员 2020-06-04 15:22:21 464 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    你的动作是:com.iStudy.Studying
    但是你intent-filter 的定义是com.iStudy.Study.Studying
    当然找不到了...

    2020-06-04 16:08:22
    赞同 展开评论 打赏
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
58同城Android客户端Walle框架演进与实践之路 立即下载
Android组件化实现 立即下载
蚂蚁聚宝Android秒级编译——Freeline 立即下载