2011-12-08 76 views
0

你好傢伙我得到了一個問題,我想切換ne advertise取決於哪些是可用的。 所以我得到這個代碼 `Madvertise Callback Listener

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); 
      } 
     } 
    }); 
}` 

現在即時得到2個錯誤和downt知道如何解決它.... 這是第一個: 類型新MadvertiseView.MadvertiseViewCallbackListener(){}必須實現繼承抽象方法MadvertiseView.MadvertiseViewCallbackListener.onError(例外)

這是第二次: 類型新MadvertiseView.MadvertiseViewCallbackListener(){}必須實現繼承抽象方法MadvertiseView.MadvertiseViewCallbackListener.onIllegalHttpStatusCode(INT,字符串)

我希望任何人都可以幫助我。

回答

1

要實現它具有三種方法onLoadedonIllegalHttpStatusCodeonError接口,所以只需添加此下方的onLoaded方法:

@Override 
public void onIllegalHttpStatusCode(int statusCode, String message) { 
// TODO Auto-generated method stub 
} 

@Override 
public void onError(Exception exception) { 
// TODO Auto-generated method stub 
}