You would do this in the xml instead of the java code. I haven’t attempted this myself but I did find this example.
<xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:id="@+id/MainLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@drawable/backrepeat"
>
then in an xml called backrepeat.xml
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="https://stackoverflow.com/questions/1311042/@drawable/back"
android:tileMode="repeat" />
reference