Tag Archives: drawable

1,355 views

Android Studio failed to convert drawable into a drawable

Try this: – check names of drawables (file name must contain only abc…xyz 012…789 _ . in Resources folder , names have to start with lower case MyImage.jpg == problem , names with space my image.jpg == problem, names with … Continue reading

Posted in Android Studio, Bugs, warnings, errors | Tagged , | Comments Off on Android Studio failed to convert drawable into a drawable
3,958 views

Drawable Bitmap get width height Android

Drawable dr = getResources().getDrawable(R.drawable.algebra); int h = dr.getIntrinsicHeight(); int w = dr.getIntrinsicWidth();   Bitmap ball = BitmapFactory.decodeResource(getResources(), R.drawable.algebra); int _nWidth = ball.getWidth(); int _nHeight = ball.getHeight();

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on Drawable Bitmap get width height Android
8,780 views

How get Drawable Android example

InputStream, getResources(),openRawResource() java.io.InputStream is; is = context.getResources().openRawResource(R.drawable.my_image);   Drawable mDrawable = context.getResources().getDrawable(R.drawable.button); mDrawable.setBounds(150, 20, 300, 100);     Drawable[] mDrawables; int[] resIDs = new int[] { R.drawable.btn_ok, R.drawable.btn_storno, R.drawable.btn_help }; mDrawables = new Drawable[resIDs.length]; Drawable prev = mDrawable; for (int … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged , | Comments Off on How get Drawable Android example
3,255 views

Download file from URL

Download image file from URL to ImageView Java Android source example code. Context context = thisClass.this; Drawable image = ImageOperations(context, "http://android.okhelp.cz/images/adictionary/ad_4.png" ,"image.jpg"); ImageView imgView; imgView = (ImageView)findViewById(R.id.idImageView); imgView.setImageDrawable(image);   private Drawable ImageOperations(Context ctx, String url, String saveFilename) { try { … Continue reading

Posted in Android Examples Code, Bitmap, drawing | Tagged , , , , , , , , | Comments Off on Download file from URL