Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.rocktest;
- import com.mopub.mobileads.MoPubView;
- import android.app.Activity;
- import android.os.Bundle;
- import android.view.Menu;
- import android.view.MenuItem;
- public class MainActivity extends Activity {
- private MoPubView moPubView;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- moPubView = (MoPubView) findViewById(R.id.adview);
- moPubView.setAdUnitId("0fe0525c6b80as2295fa123138070049");
- moPubView.loadAd();
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
- protected void onDestroy() {
- moPubView.destroy();
- super.onDestroy();
- }
- }
- FATAL EXCEPTION: main
- Process: com.example.rocktest, PID: 16528
- java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.rocktest/com.example.rocktest.MainActivity}: java.lang.NullPointerException
- at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2436)
- at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2495)
- at android.app.ActivityThread.access$900(ActivityThread.java:170)
- at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1304)
- at android.os.Handler.dispatchMessage(Handler.java:102)
- at android.os.Looper.loop(Looper.java:146)
- at android.app.ActivityThread.main(ActivityThread.java:5635)
- at java.lang.reflect.Method.invokeNative(Native Method)
- at java.lang.reflect.Method.invoke(Method.java:515)
- at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291)
- at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
- at dalvik.system.NativeStart.main(Native Method)
- Caused by: java.lang.NullPointerException
- at com.example.rocktest.MainActivity.onCreate(MainActivity.java:19)
- at android.app.Activity.performCreate(Activity.java:5585)
- at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
- at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2400)
- ... 11 more
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement