Advertisement
Guest User

Untitled

a guest
Mar 28th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.28 KB | None | 0 0
  1.  
  2. public class MainActivity extends AppCompatActivity {
  3.  
  4.     @Override
  5.     protected void onCreate(Bundle savedInstanceState) {
  6.         super.onCreate(savedInstanceState);
  7.         setContentView(R.layout.activity_main);
  8.  
  9.         String appKey = "7f867222b5e84d778754b6fe94eed593b86bb483e5844965";
  10.         Appodeal.initialize(this, appKey, Appodeal.BANNER);
  11.         Appodeal.setTesting(true);
  12.         Appodeal.show(this, Appodeal.BANNER_TOP);
  13.  
  14.  
  15. //        AdView adView = (AdView) findViewById(R.id.adView);
  16. //        AdRequest adRequest = new AdRequest.Builder().build();
  17. //        adView.loadAd(adRequest);
  18.  
  19.         Appodeal.setBannerCallbacks(new BannerCallbacks() {
  20.             @Override
  21.             public void onBannerLoaded(int i, boolean b) {
  22.                 showToast("onBannerLoaded");
  23.             }
  24.  
  25.             @Override
  26.             public void onBannerFailedToLoad() {
  27.                 showToast("onBannerFailedToLoad");
  28.             }
  29.  
  30.             @Override
  31.             public void onBannerShown() {
  32.                 showToast("onBannerShown");
  33.             }
  34.  
  35.             @Override
  36.             public void onBannerClicked() {
  37.                 showToast("onBannerClicked");
  38.             }
  39.  
  40.             private Toast mToast;
  41.  
  42.             void showToast(final String text) {
  43.                 if (mToast == null) {
  44.                     mToast = Toast.makeText(MainActivity.this, text, Toast.LENGTH_SHORT);
  45.                 }
  46.                 mToast.setText(text);
  47.                 mToast.setDuration(Toast.LENGTH_SHORT);
  48.                 mToast.show();
  49.             }
  50.         });
  51.  
  52.     }
  53.  
  54.  
  55.     @Override
  56.     public boolean onCreateOptionsMenu(Menu menu) {
  57.         // Inflate the menu; this adds items to the action bar if it is present.
  58.         getMenuInflater().inflate(R.menu.menu_main, menu);
  59.         return true;
  60.     }
  61.  
  62.     @Override
  63.     public boolean onOptionsItemSelected(MenuItem item) {
  64.         // Handle action bar item clicks here. The action bar will
  65.         // automatically handle clicks on the Home/Up button, so long
  66.         // as you specify a parent activity in AndroidManifest.xml.
  67.         int id = item.getItemId();
  68.  
  69.         if (id == R.id.action_settings) {
  70.             return true;
  71.         }
  72.  
  73.         return super.onOptionsItemSelected(item);
  74.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement