1

I want to use an ActivityRecognitionClient and a LocationClient in the same Activity. The trouble is that either calls onConnected.

I would like to use both e.g. to write the location and the recognized activity to a database.

I thought that should be a rather easy thing to do but could not find out how. Hope someone can help.

UPDATE

I use Services now instead of Activities and implement the clients separately, connecting when the service is started and disconnecting when it is destroyed.

TheCodeArtist
  • 21,479
  • 4
  • 69
  • 130
stofl
  • 47
  • 1
  • 7

1 Answers1

0

The same activity cannot implement two methods with the same name from different interfaces. This is well explained here Java - Method name collision in interface implementation

You might want to make separate classes implementing each interface separately and call your methods to read/write to your database from both of them.

Community
  • 1
  • 1
sej101
  • 225
  • 2
  • 11