Tag Archives: getresources

35,526 views

Get Resource ID by Resources String Name Android example

// image from res/drawable int resID = getResources().getIdentifier("my_image", "drawable", getPackageName()); // view int resID = getResources().getIdentifier("my_resource", "id", getPackageName());   // string int resID = getResources().getIdentifier("my_string", "string", getPackageName());

Posted in Android Examples Code | Tagged , | Comments Off on Get Resource ID by Resources String Name Android example
11,295 views

Get text file content from raw folder to StringBuilder Android example

StringBuilder, res/raw folder, try catch finaly throws, BufferedReader, InputStream, openRawResource, getResources Android example MainActivity.java   public class MainActivity extends Activity { TextView txtV; Context cntx;   @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); txtV = (TextView)findViewById(R.id.idLabel); cntx = this; … Continue reading

Posted in Android Examples Code | Tagged , , , , , , | Comments Off on Get text file content from raw folder to StringBuilder Android example