Android studio create directories

Asked

Viewed 747 times

1

How can I create a folder in android studio (to save images - my project will have many images and would like to split into folders or packages for better organization)? If I create in the directory option it create the real folder, but do not create in the folder tree on the left side. I was creating inside the drawable.

1 answer

1

You can add in the Assets folder, and there create subdirectories

To load from the Assets folder:

   try {
    // carrega a imagem
    InputStream ims = getAssets().open("pasta1/img1.jpg");
    // Transforma em Drawable
    Drawable d = Drawable.createFromStream(ims, null);
    // set image to ImageView
    //mImage.setImageDrawable(d);
}
catch(IOException e) {

}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.