Android Open Source - Android-Sample-App Basic Activity






From Project

Back to project page Android-Sample-App.

License

The source code is released under:

End-User License Agreement for Sharethrough Software Product This End-User License Agreement (?EULA??) is a legal agreement between you (either an individual or a single entity) (?the End User?...

If you think the Android project Android-Sample-App listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.sharethrough.sample;
//from   ww w  . j  a  v  a  2  s  .  c om
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import com.sharethrough.sdk.BasicAdView;
import com.sharethrough.sdk.Sharethrough;

public class BasicActivity extends Activity {

    public static final String PLACEMENT_KEY = "155c3656";
    private Sharethrough sharethrough;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.basic_activity);

        final BasicAdView adViewWithDescription = (BasicAdView) findViewById(R.id.sharethrough_ad_with_description);
        final BasicAdView adViewWithoutDescription = (BasicAdView) findViewById(R.id.sharethrough_ad_without_description);

        adViewWithDescription.setVisibility(View.GONE);
        adViewWithoutDescription.setVisibility(View.GONE);

        sharethrough = new Sharethrough(this, PLACEMENT_KEY, 1000);
        sharethrough.setOnStatusChangeListener(new Sharethrough.OnStatusChangeListener() {
            @Override
            public void newAdsToShow() {
                adViewWithDescription.setVisibility(View.VISIBLE);
                adViewWithoutDescription.setVisibility(View.VISIBLE);
            }

            @Override
            public void noAdsToShow() {
                adViewWithDescription.setVisibility(View.GONE);
                adViewWithoutDescription.setVisibility(View.GONE);
            }
        });

        adViewWithDescription.prepareWithResourceIds(R.layout.basic_ad, R.id.title, R.id.description, R.id.advertiser, R.id.thumbnail, R.id.optout_icon, R.id.brand_logo);
        sharethrough.putCreativeIntoAdView(adViewWithDescription);

        adViewWithoutDescription.prepareWithResourceIds(R.layout.basic_ad, R.id.title, -1, R.id.advertiser, R.id.thumbnail, R.id.optout_icon, -1);
        sharethrough.putCreativeIntoAdView(adViewWithoutDescription);
    }

    // Only for testing
    Sharethrough getSharethrough() {
        return sharethrough;
    }
}




Java Source Code List

com.sharethrough.SampleApplication.java
com.sharethrough.sample.BasicActivity.java
com.sharethrough.sample.DfpActivity.java
com.sharethrough.sample.FeedItem.java
com.sharethrough.sample.ListAdapterWithBasicViewActivity.java
com.sharethrough.sample.MyActivity.java
com.sharethrough.sample.SharethroughListAdapterActivity.java