Basically, I want to try changing a button’s background at main interface, but I want it done from an intent. So, for example I have this main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TableRow
android:gravity="center"
android:layout_margin="20px">
<Button
android:id="@+id/tunein"
android:layout_width="125px"
android:layout_height="125px"
android:gravity="center"
android:layout_margin="20px"
android:background="@drawable/tunein"
>
</Button>
<Button
android:id="@+id/settings"
android:layout_width="125px"
android:layout_height="125px"
android:gravity="center"
android:layout_margin="20px"
android:background="@drawable/settings">
</Button>
</TableRow>
<TableRow
android:gravity="center"
android:layout_margin="20px">
<Button
android:id="@+id/share"
android:layout_width="125px"
android:layout_height="125px"
android:gravity="center"
android:layout_margin="20px"
android:background="@drawable/sharing">
</Button>
<Button
android:id="@+id/profile"
android:layout_width="125px"
android:layout_height="125px"
android:gravity="center"
android:background="@drawable/icon"
android:layout_margin="20px">
</Button>
</TableRow>
</TableLayout>
</LinearLayout>
Then if the button with id ‘profile’ is clicked, an intent shows up and it will show a gallery with images from SDCARD and when user clicks one of the image, the ‘profile’ button’s background will change….
how to do it…??? THX for help
In button onclick you just call the code for gallery images to display like
then after returning from gallery you will get image-path from that image path you can place the image in button