예제 #1
0
  @Override
  public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AdRegistration.enableLogging(true);
    LayoutInflater inflater = (LayoutInflater) this.getSystemService(this.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.main, null);

    this.adView = (AdLayout) view.findViewById(R.id.ad_view);
    this.adView.setListener(new SampleAdListener());

    addContentView(view, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));

    try {
      AdRegistration.setAppKey(APP_KEY);
    } catch (final Exception e) {
      Log.e(LOG_TAG, "Exception thrown: " + e.toString());
      return;
    }

    loadAd();
  }