Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.25 KB | None | 0 0
  1. package com.example.rocktest;
  2.  
  3. import com.mopub.mobileads.MoPubView;
  4.  
  5. import android.app.Activity;
  6. import android.os.Bundle;
  7. import android.view.Menu;
  8. import android.view.MenuItem;
  9.  
  10. public class MainActivity extends Activity {
  11. private MoPubView moPubView;
  12.  
  13. @Override
  14. protected void onCreate(Bundle savedInstanceState) {
  15. super.onCreate(savedInstanceState);
  16. setContentView(R.layout.activity_main);
  17.  
  18. moPubView = (MoPubView) findViewById(R.id.adview);
  19. moPubView.setAdUnitId("0fe0525c6b80as2295fa123138070049");
  20. moPubView.loadAd();
  21. }
  22.  
  23. @Override
  24. public boolean onCreateOptionsMenu(Menu menu) {
  25. // Inflate the menu; this adds items to the action bar if it is present.
  26. getMenuInflater().inflate(R.menu.main, menu);
  27. return true;
  28. }
  29.  
  30. protected void onDestroy() {
  31. moPubView.destroy();
  32. super.onDestroy();
  33. }
  34. }
  35.  
  36. FATAL EXCEPTION: main
  37. Process: com.example.rocktest, PID: 16528
  38. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.rocktest/com.example.rocktest.MainActivity}: java.lang.NullPointerException
  39. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2436)
  40. at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495)
  41. at android.app.ActivityThread.access$900(ActivityThread.java:170)
  42. at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304)
  43. at android.os.Handler.dispatchMessage(Handler.java:102)
  44. at android.os.Looper.loop(Looper.java:146)
  45. at android.app.ActivityThread.main(ActivityThread.java:5635)
  46. at java.lang.reflect.Method.invokeNative(Native Method)
  47. at java.lang.reflect.Method.invoke(Method.java:515)
  48. at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
  49. at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
  50. at dalvik.system.NativeStart.main(Native Method)
  51. Caused by: java.lang.NullPointerException
  52. at com.example.rocktest.MainActivity.onCreate(MainActivity.java:19)
  53. at android.app.Activity.performCreate(Activity.java:5585)
  54. at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
  55. at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2400)
  56. ... 11 more
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement