Note that there are some explanatory texts on larger screens.

plurals
  1. POaddView nullpointerexception admob network
    primarykey
    data
    text
    <p>It gives an error when admob is added. If I remove it works properly. Where is the problem, thanks.</p> <p>My problem;</p> <pre><code>layout.addView(adView); at com.zilsesleri.SoundList.onCreate(SoundList.java:55) </code></pre> <p>SoundList class;</p> <pre><code>public class SoundList extends ListActivity { int [] soundfile; MediaPlayer mediaPlayer; final Activity act = this; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); soundfile= new int[] {R.raw.sound1,R.raw.sound2}; String[] newsounds = getResources().getStringArray(R.array.newsounds); this.setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.list_item, R.id.label, newsounds)); ListView lv = getListView(); lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { Intent intent = new Intent(getApplicationContext(), SingleListItem.class); intent.putExtra("position", position); startActivity(intent); } }); LinearLayout layout = (LinearLayout)findViewById(R.id.reklam); AdView adView = new AdView(this, AdSize.BANNER, "...."); layout.addView(adView); AdRequest request = new AdRequest(); //request.setTesting(true); adView.loadAd(request); } </code></pre> <p>List_item.xml layout</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/label" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dip" android:textSize="18dip" android:textStyle="bold" &gt; &lt;/TextView&gt; &lt;LinearLayout android:id="@+id/reklam" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>Error log;</p> <pre><code>11-17 00:53:49.700: E/AndroidRuntime(30935): FATAL EXCEPTION: main 11-17 00:53:49.700: E/AndroidRuntime(30935): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.zilsesleri/com.zilsesleri.SoundList}: java.lang.NullPointerException 11-17 00:53:49.700: E/AndroidRuntime(30935): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967) 11-17 00:53:49.700: E/AndroidRuntime(30935): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992) 11-17 00:53:49.700: E/AndroidRuntime(30935): at android.app.ActivityThread.access$600(ActivityThread.java:127) 11-17 00:53:49.700: E/AndroidRuntime(30935): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158) 11-17 00:53:49.700: E/AndroidRuntime(30935): at android.os.Handler.dispatchMessage(Handler.java:99) 11-17 00:53:49.700: E/AndroidRuntime(30935): at android.os.Looper.loop(Looper.java:137) 11-17 00:53:49.700: E/AndroidRuntime(30935): at android.app.ActivityThread.main(ActivityThread.java:4441) 11-17 00:53:49.700: E/AndroidRuntime(30935): at java.lang.reflect.Method.invokeNative(Native Method) 11-17 00:53:49.700: E/AndroidRuntime(30935): at java.lang.reflect.Method.invoke(Method.java:511) 11-17 00:53:49.700: E/AndroidRuntime(30935): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 11-17 00:53:49.700: E/AndroidRuntime(30935): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 11-17 00:53:49.700: E/AndroidRuntime(30935): at dalvik.system.NativeStart.main(Native Method) 11-17 00:53:49.700: E/AndroidRuntime(30935): Caused by: java.lang.NullPointerException 11-17 00:53:49.700: E/AndroidRuntime(30935): at com.zilsesleri.SoundList.onCreate(SoundList.java:55) 11-17 00:53:49.700: E/AndroidRuntime(30935): at android.app.Activity.performCreate(Activity.java:4465) 11-17 00:53:49.700: E/AndroidRuntime(30935): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049) 11-17 00:53:49.700: E/AndroidRuntime(30935): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931) 11-17 00:53:49.700: E/AndroidRuntime(30935): ... 11 more </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload