Issue
I want to switch ne advertise depending on which is available. So I got this code:
public class ActivityMain extends Activity {
/** Called when the activity is first created. */
private MadvertiseView mMadView;
private AdView mAdmView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mAdmView = (AdView)findViewById(R.id.admad);
mMadView = (MadvertiseView)findViewById(R.id.madad);
mMadView.setMadvertiseViewCallbackListener(new MadvertiseViewCallbackListener() {
@Override public void onLoaded(boolean success, MadvertiseView arg1) {
if (success) {
if (mAdmView.getVisibility() == View.VISIBLE) {
mAdmView.setVisibility(View.GONE);
}
mMadView.setVisibility(View.VISIBLE);
} else {
mMadView.setVisibility(View.GONE);
}
}
});
}`
Now Im getting 2 errors and downt know how to fix it.... This is the first: The type new MadvertiseView.MadvertiseViewCallbackListener(){} must implement the inherited abstract method MadvertiseView.MadvertiseViewCallbackListener.onError(Exception)
And this is the Second: The type new MadvertiseView.MadvertiseViewCallbackListener(){} must implement the inherited abstract method MadvertiseView.MadvertiseViewCallbackListener.onIllegalHttpStatusCode(int, String)
I Hope anyone can help me with this.
Solution
You are implementing an interface which has the three methods onLoaded
, onIllegalHttpStatusCode
and onError
, so just add this below your onLoaded
method:
@Override
public void onIllegalHttpStatusCode(int statusCode, String message) {
// TODO Auto-generated method stub
}
@Override
public void onError(Exception exception) {
// TODO Auto-generated method stub
}
Answered By - Don Ho