정적 브로드캐스트리시버를 사용하려고 합니다.
FrameLayout를 상속받은 클래스에서 터치이벤트를 입력받고, FragmentActivity를 상속받은 맵 액티비티에서 방송을 캐치하려고 합니다.
매니패스트에
<receiver android:name=".MapActivity" >
<intent-filter>
<action android:name="com.nate.ltereporting.action.ACTION_DOWN" />
<action android:name="com.nate.ltereporting.action.ACTION_UP" />
</intent-filter>
</receiver>
FrameLayout를 상속받은 클래스에서
@Override
public boolean dispatchTouchEvent(MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
intent = new Intent("com.nate.ltereporting.action.ACTION_DOWN");
getContext().sendBroadcast(intent);
break;
case MotionEvent.ACTION_UP:
intent = new Intent("com.nate.ltereporting.action.ACTION_UP");
getContext().sendBroadcast(intent);
break;
}
return super.dispatchTouchEvent(event);
}
그리고 맵 액티비티에서
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals("com.nate.ltereportin.action.ACTION_DOWN")) {
Log.d("fureun", "Action Down");
}
else if (intent.getAction().equals("com.nate.ltereportin.action.ACTION_DOWN")) {
Log.d("fureun", "Action Up");
}
}
};
이렇게 했는데 안되더라구요 ... 어떻게 해야 원하는 결과를 얻을 수 있을까요 ??
에러 내용은