Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MainActivity extends AppCompatActivity {
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- String appKey = "7f867222b5e84d778754b6fe94eed593b86bb483e5844965";
- Appodeal.initialize(this, appKey, Appodeal.BANNER);
- Appodeal.setTesting(true);
- Appodeal.show(this, Appodeal.BANNER_TOP);
- // AdView adView = (AdView) findViewById(R.id.adView);
- // AdRequest adRequest = new AdRequest.Builder().build();
- // adView.loadAd(adRequest);
- Appodeal.setBannerCallbacks(new BannerCallbacks() {
- @Override
- public void onBannerLoaded(int i, boolean b) {
- showToast("onBannerLoaded");
- }
- @Override
- public void onBannerFailedToLoad() {
- showToast("onBannerFailedToLoad");
- }
- @Override
- public void onBannerShown() {
- showToast("onBannerShown");
- }
- @Override
- public void onBannerClicked() {
- showToast("onBannerClicked");
- }
- private Toast mToast;
- void showToast(final String text) {
- if (mToast == null) {
- mToast = Toast.makeText(MainActivity.this, text, Toast.LENGTH_SHORT);
- }
- mToast.setText(text);
- mToast.setDuration(Toast.LENGTH_SHORT);
- mToast.show();
- }
- });
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.menu_main, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Handle action bar item clicks here. The action bar will
- // automatically handle clicks on the Home/Up button, so long
- // as you specify a parent activity in AndroidManifest.xml.
- int id = item.getItemId();
- if (id == R.id.action_settings) {
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement