0

My XML File test.xml :

<?xml version="1.0" encoding="UTF-8"?>
<resources>
<item name="img_test" type="imgt" drawable="testimage"></item> 
</resources>

My Activity:

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

    }
}

My aim:

In the onCreate() Method, set to in xml file on drawable ?

Thanks.

Serkan
  • 13
  • 4

1 Answers1

0

I'm not sure exactly what you meant, but you could use this method to get your Drawable:

ContextCompat.getDrawable(MainActivity.this, R.drawable.img_test);

Have a look at this answer for more information.

Community
  • 1
  • 1
rlukas
  • 16
  • 2