CallBack不起作用,请帮忙

时间:2011-09-23 11:27:30

标签: android

不知怎的,我的回调不起作用......

来自发送活动:

Intent intent=new Intent();
intent.setAction("Constructor.rob.call");
sendBroadcast(intent);

接收活动:

public class popup extends Activity {

    /** Called when the activity is first created. */
    @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.popupcanvas);

            IntentFilter filter = new IntentFilter("Constructor.rob.com.call");
            this.registerReceiver(new Receiver(), filter);    
    }


    private class Receiver extends BroadcastReceiver {
        @Override
        public void onReceive(Context arg0, Intent arg1) {
            finish();
        }
    }

}

并从清单中获取:

...
<intent-filter>
<action android:name="Constructor.rob.com.call" />
</intent-filter> 

</application>
</manifest>

任何想法可能出错?谢谢!

1 个答案:

答案 0 :(得分:2)

您正在发送"Constructor.rob.call"但正在发送"Constructor.rob.com.call"