コード例 #1
0
ファイル: MainActivity.java プロジェクト: jinjianxin/android
  @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();
  }
コード例 #2
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_story_main);

    AdRegistration.setAppKey("531ee8a153a14a45a4e1d6600bd31b32");

    a1 = (Button) findViewById(R.id.a1);
    a2 = (Button) findViewById(R.id.a2);

    final Map<String, String> epList = new HashMap<String, String>();
    epList.put("a1", "file:///android_asset/index.html");

    final AP ap = (AP) getApplication();

    a1.setOnClickListener(
        new OnClickListener() {

          public void onClick(View v) {
            // TODO Auto-generated method stub

            ap.clearAP();
            ap.setValueForKey("ep", epList.get("a1"));
            startActivity(new Intent(StoryMainActivity.this, AboutApp.class));
          }
        });

    a2.setOnClickListener(
        new OnClickListener() {

          public void onClick(View v) {
            // TODO Auto-generated method stub
            ap.clearAP();
            ap.setValueForKey("ep", epList.get("a2"));
            startActivity(new Intent(StoryMainActivity.this, AboutApp1.class));
          }
        });
  }