• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps simple question about drawables

trueReaper

Lurker
Oct 15, 2010
1
0
Hey, im pretty new to programing for the android and im running into some problems.
I have two separate questions which i think have pretty simple answers.

First. I want to have a defalt image as my background but i would also like it the user to be able to chose a image from their photos or take a picture from their camera and set that as the background.

If you post code could you please commit it or explain it? I would like to understand how one does this.

Thank you for your time.
 
Adding:

Code:
android:background="@drawable/background"

to your Layout declaration in your .xml file will use a file named "background" from your res/drawable folder. So your main.xml looks like:

Code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background">

<!-- all your other views and layout stuff here -->

</RelativeLayout>
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones