Every single one of my apps need something like this. It's boring to explain in more details what's traditionally needed to make sure an AlertDialog is only shown once. Now, with this OneTimeAlertDialog.java, it's much easier to create new AlertDialogs that are only shown once.
/** Prompt that is only shown once to user. */
OneTimeAlertDialog.Builder(this, "my_dialog_key")
.setTitle("My Title")
.setMessage("My Message")
.show();
For something I use so often, I was surprised to not find a similar project on GitHub. So, I've added it: Android OneTimeAlertDialog
~ Danial Goodwin ~
Showing posts with label prompt. Show all posts
Showing posts with label prompt. Show all posts
2015-02-13
2014-02-07
Level Up - Windows 8: How to Copy/Move Files From Many Subfolders To Just One Folder
Long Title: How to Transfer Files From Many Subfolders To Just One Folder and Rename Them All Easily and Quickly.
Example: I had about 100 images that were all neatly organized into 100 different subfolders. I wanted to put them in just five different subfolder as painless as possible. Manually moving each image one-by-one was not ideal, so here's what I did, using the Windows Command Prompt and a Batch file:
1. Create a BAT file.
2. Add the following code:
FOR /L %%i IN (0,1,19) DO (
copy %cd%\ic_launcher(%%i)\res\drawable-mdpi\ic_launcher.png %cd%\_mdpi\data_cycle_%%i.png
copy %cd%\ic_launcher(%%i)\res\drawable-hdpi\ic_launcher.png %cd%\_hdpi\data_cycle_%%i.png
copy %cd%\ic_launcher(%%i)\res\drawable-xhdpi\ic_launcher.png %cd%\_xhdpi\data_cycle_%%i.png
copy %cd%\ic_launcher(%%i)\res\drawable-xxhdpi\ic_launcher.png %cd%\_xxhdpi\data_cycle_%%i.png
copy %cd%\ic_launcher(%%i)\res\drawable-xxxhdpi\ic_launcher.png %cd%\_xxxhdpi\data_cycle_%%i.png
)
3. Run the BAT by double-clicking the file (or right-click->Open) (or run via command prompt).
Note:
- The parenthesis after "DO" must go on the same line. Putting it on the next line will cause the file to not work properly.
- If you want to move files rather than copy, then change "copy" to "move".
- If you want to keep the same file names, then you don't have to specify the file name on the second parameter.
Now in a simpler English, what this batch file does:
- There are five "copy" commands with a source and destination.
- These commands are each ran 20 times because of the "FOR" command.
- The "FOR" line says do the following commands within the parentheses 20 times. The first time will have the variable "%%i" equal to 0. The second run will have "%%i" equal to 1. The variable will keep incrementing until "%%i" is equal to 19. This behavior is defined at "%%i IN (0,1,19)", where 0 is the starting number, 19 is the ending number, and 1 is the increment number (which could also be negative).
For more information about for-loops, then type "for /?" into the command prompt.
Here's some more commands that you can try: Windows Command Prompt Cheat Sheet
~ Danial Goodwin ~
Example: I had about 100 images that were all neatly organized into 100 different subfolders. I wanted to put them in just five different subfolder as painless as possible. Manually moving each image one-by-one was not ideal, so here's what I did, using the Windows Command Prompt and a Batch file:
1. Create a BAT file.
2. Add the following code:
FOR /L %%i IN (0,1,19) DO (
copy %cd%\ic_launcher(%%i)\res\drawable-mdpi\ic_launcher.png %cd%\_mdpi\data_cycle_%%i.png
copy %cd%\ic_launcher(%%i)\res\drawable-hdpi\ic_launcher.png %cd%\_hdpi\data_cycle_%%i.png
copy %cd%\ic_launcher(%%i)\res\drawable-xhdpi\ic_launcher.png %cd%\_xhdpi\data_cycle_%%i.png
copy %cd%\ic_launcher(%%i)\res\drawable-xxhdpi\ic_launcher.png %cd%\_xxhdpi\data_cycle_%%i.png
copy %cd%\ic_launcher(%%i)\res\drawable-xxxhdpi\ic_launcher.png %cd%\_xxxhdpi\data_cycle_%%i.png
)
3. Run the BAT by double-clicking the file (or right-click->Open) (or run via command prompt).
Note:
- The parenthesis after "DO" must go on the same line. Putting it on the next line will cause the file to not work properly.
- If you want to move files rather than copy, then change "copy" to "move".
- If you want to keep the same file names, then you don't have to specify the file name on the second parameter.
Now in a simpler English, what this batch file does:
- There are five "copy" commands with a source and destination.
- These commands are each ran 20 times because of the "FOR" command.
- The "FOR" line says do the following commands within the parentheses 20 times. The first time will have the variable "%%i" equal to 0. The second run will have "%%i" equal to 1. The variable will keep incrementing until "%%i" is equal to 19. This behavior is defined at "%%i IN (0,1,19)", where 0 is the starting number, 19 is the ending number, and 1 is the increment number (which could also be negative).
For more information about for-loops, then type "for /?" into the command prompt.
Here's some more commands that you can try: Windows Command Prompt Cheat Sheet
~ Danial Goodwin ~
2014-02-02
Level Up - Windows 8: How to Create a Batch File
Batch (*.bat) files are useful because they allow you to save and reuse commands for the command prompt (or CLI, command-line interface). Also, it is easier to send multiple commands at once, fix typos, and edit the commands.
Batch files are available for Windows 7, 8, and 8.1. Any command that you can put in the CLI, you should be able to put into the BAT file.
Method 1:
- Right-click on your desktop (or in File Explorer), and select New->Text Document. Now, rename the file to something ending with .bat.
Method 2:
- Open Notepad, then when you save the file, make sure to end it with ".bat".
Test the Batch file:
Now that you have the BAT file, you can easily test that it works by putting in the following code, then double-click to run the file.
Here's some more things you can try out: Windows Command Prompt Cheat Sheet
Note: If method 1 didn't work for you, then try method 2.
~ Danial Goodwin ~
Batch files are available for Windows 7, 8, and 8.1. Any command that you can put in the CLI, you should be able to put into the BAT file.
Method 1:
- Right-click on your desktop (or in File Explorer), and select New->Text Document. Now, rename the file to something ending with .bat.
Method 2:
- Open Notepad, then when you save the file, make sure to end it with ".bat".
![]() |
| Saving a Batch file requires a .bat ending. |
Now that you have the BAT file, you can easily test that it works by putting in the following code, then double-click to run the file.
echo Hello, World!
Here's some more things you can try out: Windows Command Prompt Cheat Sheet
Note: If method 1 didn't work for you, then try method 2.
~ Danial Goodwin ~
Subscribe to:
Posts (Atom)
