Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. File photos = new File(getFilesDir(),"photos");
  2. photos.mkdir();
  3.  
  4. AlertDialog.Builder alert = new AlertDialog.Builder(this);
  5.  
  6. alert.setTitle("Title");
  7. alert.setMessage("Message");
  8.  
  9. // Set an EditText view to get user input
  10. final EditText input = new EditText(this);
  11. alert.setView(input);
  12.  
  13. alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
  14. public void onClick(DialogInterface dialog, int whichButton) {
  15. String value = input.getText();
  16. // Do something with value!
  17.  
  18. //This is where you would put your make directory code
  19. File photos = new File(getFilesDir(),value);
  20. photos.mkdir();
  21. }
  22. });
  23.  
  24. alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
  25. public void onClick(DialogInterface dialog, int whichButton) {
  26. // Canceled.
  27. }
  28. });
  29.  
  30. alert.show();
  31.  
  32. String value = "directory to create"
  33. File photos = new File(getFilesDir(),value);
  34.  
  35. if(!photos.exists())
  36. {
  37. if(photos.mkdir())
  38. {
  39. //directory is created;
  40. }
  41. }
  42.  
  43. AlertDialog.Builder alert = new AlertDialog.Builder(this);
  44.  
  45. alert.setTitle("Title");
  46. alert.setMessage("Message");
  47.  
  48. // Set an EditText view to get user input
  49. final EditText input = new EditText(this);
  50. alert.setView(input);
  51.  
  52. alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
  53. public void onClick(DialogInterface dialog, int whichButton) {
  54. String value = input.getText();
  55. // Do something with value!
  56.  
  57. //This is where you would put your make directory code
  58. File photos = new File(getFilesDir(),value);
  59. photos.mkdir();
  60. }
  61. });
  62.  
  63. alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
  64. public void onClick(DialogInterface dialog, int whichButton) {
  65. // Canceled.
  66. }
  67. });
  68.  
  69. alert.show();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement