(My first post, btw)

My problem is so newbie-esque that I can't find anyone who has asked it and oh have I tried. So here goes..:

My main screen has an imageview. Click it and it sends you to a different layout from where a bunch of images (imagebuttons) can be selected (works fine).

Pressing any of these imagebuttons should send that image to my main imageview (crashing)

I made an imageview inside this layout where the ImButtons are and sent the images there instead. This is working fine so the switch statements are ok.

I have tried to make my main imageview a "public" in my main.java but still crashing.

So the question:
*How do I send an image from one layout/class to another?*

Grateful in advance.

Jakob

Some code:

My secondary layout:

```
package egen.helt.min;

import android.app.Activity;``
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageButton;
import android.widget.ImageView;

public class FartSelect extends Activity implements OnClickListener {

    public ImageView VælgMax;
    MediaPlayer mpButtonClick;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fartselect);

        VælgMax = (ImageView) findViewById(R.id.ivValgtMax);
        ImageButton skilt30 = (ImageButton) findViewById(R.id.ib30s);
        ImageButton skilt40 = (ImageButton) findViewById(R.id.ib40s);
        ImageButton skilt50 = (ImageButton) findViewById(R.id.ib50s);
        ImageButton skilt60 = (ImageButton) findViewById(R.id.ib60s);
        ImageButton skilt70 = (ImageButton) findViewById(R.id.ib70s);
        ImageButton skilt80 = (ImageButton) findViewById(R.id.ib80s);
        ImageButton skilt90 = (ImageButton) findViewById(R.id.ib90s);
        ImageButton skilt100 = (ImageButton) findViewById(R.id.ib100s);
        ImageButton skilt110 = (ImageButton) findViewById(R.id.ib110s);
        ImageButton skilt120 = (ImageButton) findViewById(R.id.ib120s);
        ImageButton skilt130 = (ImageButton) findViewById(R.id.ib130s);

        skilt30.setOnClickListener(this);
        skilt40.setOnClickListener(this);
        skilt50.setOnClickListener(this);``
        skilt60.setOnClickListener(this);
        skilt70.setOnClickListener(this);
        skilt80.setOnClickListener(this);
        skilt90.setOnClickListener(this);
        skilt100.setOnClickListener(this);
        skilt110.setOnClickListener(this);
        skilt120.setOnClickListener(this);
        skilt130.setOnClickListener(this);

    }

    public void onClick(View v) {
        // TODO Auto-generated method stub

        switch (v.getId()) {
        case R.id.ib30s:
            VælgMax.setImageResource(R.drawable.skilt30s);
            break;
        case R.id.ib40s:
            VælgMax.setImageResource(R.drawable.skilt40s);
            break;
        case R.id.ib50s:
            VælgMax.setImageResource(R.drawable.skilt50s);
            break;
        case R.id.ib60s:
            VælgMax.setImageResource(R.drawable.skilt60s);
            break;
        case R.id.ib70s:
            VælgMax.setImageResource(R.drawable.skilt70s);
            break;
        case R.id.ib80s:
            VælgMax.setImageResource(R.drawable.skilt80s);
            break;
        case R.id.ib90s:
            VælgMax.setImageResource(R.drawable.skilt90s);
            break;
        case R.id.ib100s:
            VælgMax.setImageResource(R.drawable.skilt100s);
            break;
        case R.id.ib110s:
            VælgMax.setImageResource(R.drawable.skilt110s);
            break;
        case R.id.ib120s:
            VælgMax.setImageResource(R.drawable.skilt120s);
            break;
        case R.id.ib130s:
            VælgMax.setImageResource(R.drawable.skilt130s);
            break;

        }

    }
}

```

And here is FartSelect.xml:

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

    <ImageView
        android:id="@+id/ivValgteMax"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:src="@drawable/blanktskiltsk" />

    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="400dp" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:orientation="vertical" >

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib30s"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:background="@android:color/black"
                    android:gravity="center"
                    android:src="@drawable/skilt30s" />

                <ImageButton
                    android:id="@+id/ib40s"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:background="@android:color/black"
                    android:gravity="center"
                    android:src="@drawable/skilt40s" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib50s"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:background="@android:color/black"
                    android:gravity="center"
                    android:src="@drawable/skilt50s" />

                <ImageButton
                    android:id="@+id/ib60s"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:background="@android:color/black"
                    android:gravity="center"
                    android:src="@drawable/skilt60s" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib70s"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:background="@android:color/black"
                    android:gravity="center"
                    android:src="@drawable/skilt70s" />

                <ImageButton
                    android:id="@+id/ib80s"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:background="@android:color/black"
                    android:gravity="center"
                    android:src="@drawable/skilt80s" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib90s"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:background="@android:color/black"
                    android:gravity="center"
                    android:src="@drawable/skilt90s" />

                <ImageButton
                    android:id="@+id/ib100s"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:background="@android:color/black"
                    android:gravity="center"
                    android:src="@drawable/skilt100s" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib110s"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:background="@android:color/black"
                    android:gravity="center"
                    android:src="@drawable/skilt110s" />

                <ImageButton
                    android:id="@+id/ib120s"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:background="@android:color/black"
                    android:gravity="center"
                    android:src="@drawable/skilt120s" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib130s"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:background="@android:color/black"
                    android:gravity="center"
                    android:src="@drawable/skilt130s" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib30sk"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:background="@android:color/black"
                    android:gravity="center"
                    android:src="@drawable/skilt30sk" />

                <ImageButton
                    android:id="@+id/ib40sk"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:background="@android:color/black"
                    android:gravity="center"
                    android:src="@drawable/skilt40sk" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib50sk"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt50sk" />

                <ImageButton
                    android:id="@+id/ib60sk"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt60sk" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib70sk"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt70sk" />

                <ImageButton
                    android:id="@+id/ib80sk"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt80sk" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib90sk"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt90sk" />

                <ImageButton
                    android:id="@+id/ib100sk"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt100sk" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib110sk"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt110sk" />

                <ImageButton
                    android:id="@+id/ib120sk"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt120sk" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib130sk"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt130sk" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib30"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt30" />

                <ImageButton
                    android:id="@+id/ib40"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt40" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib50"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt50" />

                <ImageButton
                    android:id="@+id/ib60"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt60" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib70"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt70" />

                <ImageButton
                    android:id="@+id/ib80"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt80" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib90"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt90" />

                <ImageButton
                    android:id="@+id/ib100"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt100" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib110"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt110" />

                <ImageButton
                    android:id="@+id/ib120"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt120" />
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <ImageButton
                    android:id="@+id/ib130"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_weight="50"
                    android:gravity="center"
                    android:src="@drawable/skilt130" />
            </LinearLayout>
        </LinearLayout>
    </ScrollView>

</LinearLayout>

```

Within the same layout the imageview can change. Just not when sent to an imageview on main layout.