SensorModelDataCollector/src/com/clarkson/sensormodeldatacollector/WiFiScanActivity.java
/** 
	 * Creates all Dialogs that appear during user interaction with Wifi Scan Activity
	 */
Creates all Dialogs that appear during user interaction with Wifi Scan Activity
Creates all Dialogs that appear during user interaction with Wifi Scan Activity
private void buildAlertDialogs()
	{
		mWriteToFileDialog = new AlertDialog.Builder(
				WiFiScanActivity.this);
		mWriteToFileDialog.setTitle("Confirm Write To File");
		mWriteToFileDialog.setMessage("Would you like to capture this AP's scan results in a CSV file?");
		mWriteToFileDialog.setIcon(R.drawable.new_document);
		mWriteToFileDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int which) {
				mWriteToCSVFile = true;
				Toast.makeText(getApplicationContext(),
						"Writing to SD Card...", Toast.LENGTH_SHORT)
						.show();
				if(writeAPDataToCSVFile() == true)
				{
					Toast.makeText(getApplicationContext(),
							"File written successfully!", Toast.LENGTH_SHORT)
							.show();
				}
				else
				{
					Toast.makeText(getApplicationContext(),
							"Writing file to SD card failed!", Toast.LENGTH_SHORT)
							.show();
				}
			}
		});
		mWriteToFileDialog.setNegativeButton("NO",
				new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int which) {
				mWriteToCSVFile = false;
				/*Toast.makeText(getApplicationContext(),
                                "You clicked on NO", Toast.LENGTH_SHORT)
                                .show();*/
				dialog.cancel();
			}
		});
		mResetScanResultsDialog = new AlertDialog.Builder(
				WiFiScanActivity.this);
		mResetScanResultsDialog.setTitle("Reset all scan results?");
		mResetScanResultsDialog.setMessage("Would you like reset the scan counter and collected AP data?");
		mResetScanResultsDialog.setIcon(R.drawable.ic_delete);
		mResetScanResultsDialog.setPositiveButton("YES", new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int which) {
				mResetScanResults = true;
				Toast.makeText(getApplicationContext(),
						"Resetting scan results...", Toast.LENGTH_SHORT)
						.show();
				resetScanResults();
				 try {
					Thread.sleep(500);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
					Toast.makeText(getApplicationContext(),
							"Scan results reset!", Toast.LENGTH_SHORT)
							.show();				
			}
		});
		mResetScanResultsDialog.setNegativeButton("NO",
				new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int which) {
				mResetScanResults = false;
				/*Toast.makeText(getApplicationContext(),
                                "You clicked on NO", Toast.LENGTH_SHORT)
                                .show();*/
				dialog.cancel();
			}
		});
		mServerConnectionDialog = new AlertDialog.Builder(
				WiFiScanActivity.this);
		mServerConnectionDialog.setTitle("Server Connection");
		mServerConnectionDialog.setMessage("Click OK to check server connection");
		mServerConnectionDialog.setIcon(R.drawable.ic_launcher);
		mServerConnectionDialog.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int which) {
				Toast.makeText(getApplicationContext(),
						"Testing server connection...", Toast.LENGTH_SHORT)
						.show();
				if(testServerConnection() == true)
				{
					Toast.makeText(getApplicationContext(),
							"Server connected successfully", Toast.LENGTH_SHORT)
							.show();
				}
				else
				{
					Toast.makeText(getApplicationContext(),
							"Problem connecting to server, please check your settings!", Toast.LENGTH_SHORT)
							.show();
				}
			}
		});
		mServerConnectionDialog.setNegativeButton("Cancel",
				new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int which) {
				/*Toast.makeText(getApplicationContext(),
                                "You clicked on NO", Toast.LENGTH_SHORT)
                                .show();*/
				dialog.cancel();
			}
		});
	}
private void buildAlertDialogs ( ) { mWriteToFileDialog = new AlertDialog . Builder ( WiFiScanActivity . this ) ; mWriteToFileDialog . setTitle ( "Confirm Write To File" ) ; mWriteToFileDialog . setMessage ( "Would you like to capture this AP's scan results in a CSV file?" ) ; mWriteToFileDialog . setIcon ( R . drawable . new_document ) ; mWriteToFileDialog . setPositiveButton ( "YES" , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { mWriteToCSVFile = true ; Toast . makeText ( getApplicationContext ( ) , "Writing to SD Card..." , Toast . LENGTH_SHORT ) . show ( ) ; if ( writeAPDataToCSVFile ( ) == true ) { Toast . makeText ( getApplicationContext ( ) , "File written successfully!" , Toast . LENGTH_SHORT ) . show ( ) ; } else { Toast . makeText ( getApplicationContext ( ) , "Writing file to SD card failed!" , Toast . LENGTH_SHORT ) . show ( ) ; } } } ) ; mWriteToFileDialog . setNegativeButton ( "NO" , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { mWriteToCSVFile = false ; /*Toast.makeText(getApplicationContext(),
                                "You clicked on NO", Toast.LENGTH_SHORT)
                                .show();*/ dialog . cancel ( ) ; } } ) ; mResetScanResultsDialog = new AlertDialog . Builder ( WiFiScanActivity . this ) ; mResetScanResultsDialog . setTitle ( "Reset all scan results?" ) ; mResetScanResultsDialog . setMessage ( "Would you like reset the scan counter and collected AP data?" ) ; mResetScanResultsDialog . setIcon ( R . drawable . ic_delete ) ; mResetScanResultsDialog . setPositiveButton ( "YES" , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { mResetScanResults = true ; Toast . makeText ( getApplicationContext ( ) , "Resetting scan results..." , Toast . LENGTH_SHORT ) . show ( ) ; resetScanResults ( ) ; try { Thread . sleep ( 500 ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } Toast . makeText ( getApplicationContext ( ) , "Scan results reset!" , Toast . LENGTH_SHORT ) . show ( ) ; } } ) ; mResetScanResultsDialog . setNegativeButton ( "NO" , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { mResetScanResults = false ; /*Toast.makeText(getApplicationContext(),
                                "You clicked on NO", Toast.LENGTH_SHORT)
                                .show();*/ dialog . cancel ( ) ; } } ) ; mServerConnectionDialog = new AlertDialog . Builder ( WiFiScanActivity . this ) ; mServerConnectionDialog . setTitle ( "Server Connection" ) ; mServerConnectionDialog . setMessage ( "Click OK to check server connection" ) ; mServerConnectionDialog . setIcon ( R . drawable . ic_launcher ) ; mServerConnectionDialog . setPositiveButton ( "Ok" , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { Toast . makeText ( getApplicationContext ( ) , "Testing server connection..." , Toast . LENGTH_SHORT ) . show ( ) ; if ( testServerConnection ( ) == true ) { Toast . makeText ( getApplicationContext ( ) , "Server connected successfully" , Toast . LENGTH_SHORT ) . show ( ) ; } else { Toast . makeText ( getApplicationContext ( ) , "Problem connecting to server, please check your settings!" , Toast . LENGTH_SHORT ) . show ( ) ; } } } ) ; mServerConnectionDialog . setNegativeButton ( "Cancel" , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { /*Toast.makeText(getApplicationContext(),
                                "You clicked on NO", Toast.LENGTH_SHORT)
                                .show();*/ dialog . cancel ( ) ; } } ) ; }
Creates all Dialogs that appear during user interaction with Wifi Scan Activity
Creates all Dialogs that appear during user interaction with Wifi Scan Activity
//Set up our write to file dialog
 // Setting Dialog Title
 // Setting Dialog Message
 // Setting Icon to Dialog
 // Setting Positive "Yes" button
 // Write your code here to execute after dialog
 //Let user know file written successfully
 //if
 //else
 //onClick
 //setPositiveButton
 // Setting Negative "NO" Button
 // Write your code here to execute after dialog
 //onClick
 //setNegativeButton
 //Set up our reset scan results dialog
 // Setting Dialog Title
 // Setting Dialog Message
 // Setting Icon to Dialog
 // Setting Positive "Yes" button
 // Write your code here to execute after dialog
 // TODO Auto-generated catch block
 //Let user know file written successfully
 //onClick
 //setPositiveButton
 // Setting Negative "NO" Button
 // Write your code here to execute after dialog
 //onClick
 //setNegativeButton
 //Set up our server connection dialog
 // Setting Dialog Title
 // Setting Dialog Message
 // Setting Icon to Dialog
 // Setting Positive "Yes" button
 // Write your code here to execute after dialog
 //Let user know file written successfully
 //if
 //else
 //onClick
 //setPositiveButton
 // Setting Negative "Cancel" Button
 // Write your code here to execute after dialog
 //onClick
 //setNegativeButton
