ventsi.slav
ventsi.slav

Reputation: 332

Two classes to extends one activity?

Pretty new in Java and Android.

My situation: I have an app where users are looking some images. Also have and an admob at the bottom.

what I need is if the user click on the admob and returns back to the app to hide the admob.view (onDismissScreen).

At the moment I have

public class MainActivity extends Activity implements OnClickListener {

Which is listening for clicks on the images. As I see I need also :

public class BannerSample extends Activity implements AdListener {

To be able to use onDismissScreen.

How can I combine these together. Or some other solution if available?

Pretty new in android and don`t have practice so please for some example :)

Thanks all!

Upvotes: 0

Views: 577

Answers (1)

Erik Pragt
Erik Pragt

Reputation: 14617

Just use the following:

public class BannerSample extends Activity implements AdListener, OnClickListener {

And implement the necessary methods in the BannerSample.

When implementing interfaces, you can implement multiple interfaces by separating them with a comma. Note, however, that you can only extend from one class.

Upvotes: 1

Related Questions