Hi all,

I'm working on an application where I want to add adWhirl to manage
adds.
The app is working fine until I tryed to use adWhirl. I have try to
get the view created with setContentView(R.layout.main) by calling
LinearLayout layout = (LinearLayout)findViewById(R.layout.main);

and the pointer layout is null !

Here is my code :

        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.main);

                //for AdWhirl Ads
                LinearLayout layout = (LinearLayout)findViewById(R.layout.main);

                AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this,
"93b8db24920a42b297769f38d89304ba");
                RelativeLayout.LayoutParams adWhirlLayoutParams = new
RelativeLayout.LayoutParams(320, 52);
                layout.addView(adWhirlLayout, adWhirlLayoutParams);
                layout.invalidate();
...
}

and the main.xml :

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content">

<RelativeLayout
        android:id="@+id/titre"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#dcdcdc">
    <ImageButton
                        android:id="@+id/info"
                        android:background="@null"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_alignParentLeft="true"
                        android:padding="5sp"
                        android:src="@drawable/info"/>

    <TextView
                android:paddingTop="5sp"
                android:paddingBottom="5sp"
                android:gravity="center"
                android:textSize="20sp"
        android:background="#dcdcdc"
        android:textColor="#000000"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_toRightOf="@id/info"
        android:text="@string/app_name"
        />
</RelativeLayout>

<TableLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:stretchColumns="0,1,2">

    <TableRow>
            <LinearLayout
                android:orientation="vertical"
                    android:layout_marginTop="30px"
                    android:layout_marginBottom="15px"
                    android:layout_width="100px"
                    android:layout_height="wrap_content"
                    android:gravity="left">

                    <Spinner
                        android:id="@+id/spinner1"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:prompt="@string/devise_prompt"
                    />
            </LinearLayout>

            <LinearLayout
                android:orientation="vertical"
                android:layout_marginTop="30px"
                    android:layout_marginBottom="15px"
                    android:layout_width="100px"
                    android:layout_height="wrap_content"
                    android:gravity="right">

                    <Spinner
                        android:id="@+id/spinner2"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:prompt="@string/devise_prompt"
                    />
                </LinearLayout>
        </TableRow>
</TableLayout>

<TableLayout
        android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:stretchColumns="0,1,2">
        <TableRow>
                <TextView
                android:id="@+id/amount1"
                android:gravity="left"
                android:paddingLeft="30px"
                android:paddingBottom="15px"
                android:text="@string/devise_amount"
                android:textStyle="bold"
                />
                <TextView
                android:id="@+id/amount"
                android:textStyle="bold"
                />
                <TextView
                android:id="@+id/amount2"
                android:gravity="right"
                android:paddingRight="30px"
                android:paddingBottom="15px"
                android:text="@string/devise_amount"
                android:textStyle="bold"
                />
        </TableRow>

    <TableRow>
        <EditText
                android:id="@+id/edit_amount1"
                android:layout_width="100px"
                android:layout_height="wrap_content"
                android:layout_marginBottom="10px"
                android:gravity="left"
                android:inputType="numberDecimal"/>

                <ImageButton
                        android:id="@+id/egal"
                        android:background="@null"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerHorizontal="true"
                        android:layout_marginBottom="10px"
                        android:src="@drawable/equal"/>

            <EditText
                android:id="@+id/edit_amount2"
                android:layout_width="100px"
                android:layout_height="wrap_content"
                android:layout_marginBottom="10px"
                android:gravity="right"
                android:inputType="numberDecimal" />
    </TableRow>

</TableLayout>

<ImageButton
                        android:id="@+id/mataf"
                        android:background="@null"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:layout_centerHorizontal="true"
                        android:layout_marginTop="20px"
                        android:src="@drawable/mataf"/>
<TextView
        android:id="@+id/lien"
        android:paddingTop="20sp"
                android:textSize="15sp"
                android:gravity="center"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/siteweb"/>


</LinearLayout>

Does someone have any idea ???
Thank you for any help

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to