致命异常:thread-xxxx revmob

时间:2014-07-22 23:04:48

标签: revmob

Intento poner en mi app publicidad con" Revmob" pero tengo el siguiente错误:

E / AndroidRuntime(12852):致命异常:线程-1426  E / AndroidRuntime(12852):java.lang.NullPointerException  E / AndroidRuntime(12852):at com.revmob.android.RevMobContext $ 1.run(RevMobContext.java:297)

Mi codigo es el siguiente:

ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
   >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:background="#ffffff"  >

        <ImageView
            android:id="@+id/descensointernacionalpisuerga"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#ffffff" 
            android:src="@drawable/logoblanco" />

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
               >

            <Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="70dp"
                android:layout_marginTop="20dp"
                android:background="@null" />

            <Button
                android:id="@+id/button2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="15dp"             
                android:layout_marginTop="20dp"
                android:layout_toRightOf="@+id/button1"
                android:background="@null" />

             <!--   android:layout_marginRight="25dp"  solo si pongo 3 icono--> 

            <Button
                android:id="@+id/button3"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="15dp"
                android:layout_marginRight="25dp"
                android:layout_marginTop="20dp"
                android:layout_toRightOf="@+id/button2"
                android:background="@null" />

        </RelativeLayout>



        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/cartelpiraguista" >

            <TextView
                android:id="@+id/texto"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginBottom="25dp"
                android:layout_marginLeft="25dp"
                android:layout_marginRight="25dp"
                android:layout_marginTop="25dp"
                android:text=""
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:textSize="15sp" />
        </RelativeLayout>


       <LinearLayout android:id="@+id/adViewprin"
               android:layout_width="fill_parent"
               android:layout_height="wrap_content"
               android:visibility="gone"
                android:orientation="horizontal">
         </LinearLayout>
    </LinearLayout>

</ScrollView>


@Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.layout_piraguas);

            revmob = RevMob.start(this);  //THIS BEGIN MY ERROR.

            RevMobBanner banner = revmob.createBanner(this);
           ViewGroup view = (ViewGroup) findViewById(R.id.adViewprin);
            view.addView(banner);

1 个答案:

答案 0 :(得分:-1)

    My solution:

RevMobBanner banner = revmob.createBanner**(getParent())**;
           ViewGroup view = (ViewGroup) findViewById(R.id.adViewprin);
            view.addView(banner);