Setting Background from Image on Android
<p>So I have a program, this I want this program to change the background on the linear layout to a new image in the person's gallery every n minutes. Currently I am getting the path using the following...</p>

<pre><code>public String getCurrentImageLocation(){
    ContentResolver contentResolver = getContentResolver();
    Uri uri = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
    Cursor c = contentResolver.query(uri, null, null, null, null);
    Integer test2 = c.getCount();
    Random randomGenerator = new Random();
    Integer randomNumber = randomGenerator.nextInt(test2.intValue());
    c.moveToPosition(randomNumber);
    int rowId = c.getColumnIndex(MediaStore.Images.Media.DATA);
    return c.getString(rowId);
}
</code></pre>

<p>At the risk of sounding super noob, how do I get this path and turn it into a drawable that I can use for setBackgrounDrawable(Drawable d). Am I thinking about this the wrong way?</p>

<p>Thanks</p>
