Android saving file to external storage

后端 未结 12 733
抹茶落季
抹茶落季 2020-11-22 03:12

I have a little issue with creating a directory and saving a file to it on my android application. I\'m using this piece of code to do this :

String filename         


        
12条回答
  •  孤独总比滥情好
    2020-11-22 03:55

    Click Here for full description and source code

    public void saveImage(Context mContext, Bitmap bitmapImage) {
    
      File sampleDir = new File(Environment.getExternalStorageDirectory() + "/" + "ApplicationName");
    
      TextView tvImageLocation = (TextView) findViewById(R.id.tvImageLocation);
      tvImageLocation.setText("Image Store At : " + sampleDir);
    
      if (!sampleDir.exists()) {
          createpathForImage(mContext, bitmapImage, sampleDir);
      } else {
          createpathForImage(mContext, bitmapImage, sampleDir);
      }
    }
    

提交回复
热议问题