0

This is the structure I work with:

Project A is a library project
MainActivityA
Activity A1
Activity A2
Activity A3

Project B references Project A
MainActivityB 

I created a listener interface in MainActivityB (onMyCueListener) and I want to implement the listener in ProjectA activities.
The problem I face is that when I declare class ActivityA1 implements onMyCueListener on ProjectA, it is not resolved, because MainActivityB is not known in ProjectA.

ilomambo
  • 8,290
  • 12
  • 57
  • 106
  • 1
    Why not declare this listener in Project A? – Lingviston Jun 15 '13 at 18:43
  • I somehow agree with user1897423, but are you sure the dependency is set as it should? Because as far as I can see at least in this example, it seems that A depends on B and not vice versa. – Cata Jun 15 '13 at 18:48
  • @user1897423 because I need to inform the activities in ProjectA of something that ocurred in ProjectB and it's timing is not fixed, so I cannot rely on fixed calls like `onStart()` or `onResume()` – ilomambo Jun 15 '13 at 19:03
  • @Cata Project A is a library project, library projects are references for other (normal, like ProjectB) projects – ilomambo Jun 15 '13 at 19:04
  • @ilomambo so what? Declare it in project A and it will be available in both A and B projects. You may also read about EventBus pattern. Here is an example library https://github.com/greenrobot/EventBus – Lingviston Jun 15 '13 at 19:06
  • @ilomambo I agree with user1897423 in this case as I can't see any other options here.. – Cata Jun 15 '13 at 19:08

0 Answers0