src/jpm/dg/ImageRetrieveScreen.java
/**
	 * Displays a save dialog.
	 * @param initName The filename to initialise with.
	 */
Displays a save dialog.
@param initName The filename to initialise with.
Displays a save dialog . @param initName The filename to initialise with .
public void displaySaveDialog(String initName) {
		if(retrievedBitmap == null) {
			return;
		}
		AlertDialog.Builder builder = new AlertDialog.Builder(this);
		builder.setTitle(getString(R.string.filename));
		final EditText input = new EditText(this);
		input.setText(initName);
		input.setInputType(InputType.TYPE_CLASS_TEXT);
		builder.setView(input);
		builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int which) {
				String fileName = input.getText().toString().replace(" ", "_")
						.trim();
				String error = Util.isValidFileName(fileName);
				if (error.equals("")) {
					new SaveImageTask(ImageRetrieveScreen.this, fileName)
							.execute();
				} else {
					Util.showToast(getApplicationContext(), error);
					displaySaveDialog(fileName);
				}
			}
		});
		builder.setNegativeButton("Cancel",
				new DialogInterface.OnClickListener() {
					@Override
					public void onClick(DialogInterface dialog, int which) {
						dialog.cancel();
						return;
					}
				});
		builder.show();
	}
public void displaySaveDialog ( String initName ) { if ( retrievedBitmap == null ) { return ; } AlertDialog . Builder builder = new AlertDialog . Builder ( this ) ; builder . setTitle ( getString ( R . string . filename ) ) ; final EditText input = new EditText ( this ) ; input . setText ( initName ) ; input . setInputType ( InputType . TYPE_CLASS_TEXT ) ; builder . setView ( input ) ; builder . setPositiveButton ( "OK" , new DialogInterface . OnClickListener ( ) { @ Override public void onClick ( DialogInterface dialog , int which ) { String fileName = input . getText ( ) . toString ( ) . replace ( " " , "_" ) . trim ( ) ; String error = Util . isValidFileName ( fileName ) ; if ( error . equals ( "" ) ) { new SaveImageTask ( ImageRetrieveScreen . this , fileName ) . execute ( ) ; } else { Util . showToast ( getApplicationContext ( ) , error ) ; displaySaveDialog ( fileName ) ; } } } ) ; builder . setNegativeButton ( "Cancel" , new DialogInterface . OnClickListener ( ) { @ Override public void onClick ( DialogInterface dialog , int which ) { dialog . cancel ( ) ; return ; } } ) ; builder . show ( ) ; }
Displays a save dialog.
Displays a save dialog .