隐试意图:ActivityNotFoundException: No Activity found to handle Intent

		btn=(Button) findViewById(R.id.btn);
		btn.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				String text=et.getText().toString().trim();
				Intent intent=new Intent(MainActivity.this,MyBroadCastReceiver.class);
				intent.putExtra("text", text);
			//	startActivity(intent);  应该是发送广播
				sendBroadcast(intent);
				
			}
		});
今天在练习BroadCastReceiver的demo, 结果老是报错:No Activity found to handle Intent。原来是隐试意图,后面换为显示意图 还是不行。最后发现:在写button的click事件时,把sendBroadcast(intent);弄成了startActivity(intent); 蛋碎~

你可能感兴趣的:(隐试意图:ActivityNotFoundException: No Activity found to handle Intent)