Tell me how you can upload an image not into ImageView but into the folder with resources or set the downloaded image immediately as a background Activity / Fragment

    1 answer 1

    It is impossible to load something into the resources at the time of the program execution - the resources are packed into the apk file at the time of compilation.

    Displaying the downloaded image as a background is simple. To do this, upload a picture and in the end callback assign the background to the desired markup element like this :

     Picasso.with(getActivity()).load(R.drawable.table_background).into(new Target(){ @Override public void onBitmapLoaded(Bitmap bitmap, LoadedFrom from) { mainLayout.setBackground(new BitmapDrawable(context.getResources(), bitmap)); } @Override public void onBitmapFailed(final Drawable errorDrawable) { Log.d("TAG", "FAILED"); } @Override public void onPrepareLoad(final Drawable placeHolderDrawable) { Log.d("TAG", "Prepare Load"); } });