//// ERROR warning: [deprecation] getExternalStorageDirectory() in Environment has been deprecated File path = new File(Environment.getExternalStorageDirectory().getAbsolutePath()+"/MyPaintings"); ^ 1 warning //// That my cood private static String fileName; File path = new File(Environment.getExternalStorageDirectory().getAbsolutePath() +"/MyPaintings"); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); signatureView = findViewById(R.id.signature_view); seekBar = findViewById(R.id.penSize); txtPenSize = findViewById(R.id.txtPenSize); imgColor = findViewById(R.id.btnColor); imgEraser = findViewById(R.id.btnEraser); imgSave = findViewById(R.id.btnSave); askPermission(); SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()); String date = format.format(new Date()); fileName = path + "/" + date + ".png"; if (!path.exists()) { path.mkdirs(); } defaultColor = ContextCompat.getColor(MainActivity.this, R.color.black);
Quote:How can I write this code correctly? And thank you for help
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)