gt: 						String url = listItemDialogUrlEditText.getText().toString();
context: package org.bitseal.activities;
  
  import info.guardianproject.cacheword.CacheWordHandler;
  import info.guardianproject.cacheword.ICacheWordSubscriber;
  
  import java.util.ArrayList;
  
  import org.bitseal.R;
  import org.bitseal.data.ServerRecord;
  import org.bitseal.database.ServerRecordProvider;
  import org.bitseal.network.ServerHelper;
  import org.bitseal.services.AppLockHandler;
  
  import android.annotation.SuppressLint;
  import android.annotation.TargetApi;
  import android.app.Dialog;
  import android.app.ListActivity;
  import android.content.Context;
  import android.content.Intent;
  import android.content.SharedPreferences;
  import android.graphics.Rect;
  import android.os.Build;
  import android.os.Bundle;
  import android.preference.PreferenceManager;
  import android.util.Log;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.View.OnFocusChangeListener;
  import android.view.ViewGroup;
  import android.view.ViewTreeObserver.OnGlobalLayoutListener;
  import android.view.Window;
  import android.view.WindowManager;
  import android.view.inputmethod.InputMethodManager;
  import android.widget.ArrayAdapter;
  import android.widget.Button;
  import android.widget.CheckBox;
  import android.widget.EditText;
  import android.widget.LinearLayout;
  import android.widget.ListView;
  import android.widget.TextView;
  import android.widget.Toast;
  
  /**
   * The Activity class for the app's Server Settings screen. 
   * 
   * @author Jonathan Coe
   */
  public class NetworkSettingsActivity extends ListActivity implements ICacheWordSubscriber
  {    
  	private CheckBox mWifiOnlyCheckbox;
  	
  	private Button mAddNewServerButton;
  	private Button mRestoreDefaultServersButton;
  	private TextView mListItemUrlTextView;
      private ListView mServersListView;
      
      private ArrayList<ServerRecord> mServerRecords;
      
      /** The key for a boolean variable that records whether or not a user-defined database encryption passphrase has been saved */
      private static final String KEY_DATABASE_PASSPHRASE_SAVED = "databasePassphraseSaved"; 
      
      /** The key for a boolean variable that records whether or not the user has selected the 'wifi only' option*/
      private static final String WIFI_ONLY_SELECTED = "wifiOnlySelected";
      
      private CacheWordHandler mCacheWordHandler;
      
      private static final String TAG = "NETWORK_SETTINGS_ACTIVITY";
  	
  	@Override
  	protected void onCreate(Bundle savedInstanceState)
  	{
  		super.onCreate(savedInstanceState);
  		setContentView(R.layout.activity_network_settings);
  		
          // Check whether the user has set a database encryption passphrase
  		SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
  		if (prefs.getBoolean(KEY_DATABASE_PASSPHRASE_SAVED, false))
  		{
  			// Connect to the CacheWordService
  			mCacheWordHandler = new CacheWordHandler(this);
  			mCacheWordHandler.connectToService();
  		}
  		
  		// Set up the data for this activity
  		ServerRecordProvider servProv = ServerRecordProvider.get(getApplicationContext());
  		mServerRecords = servProv.getAllServerRecords();
  		if (mServerRecords.size() == 0)
  		{
  			ServerHelper servHelp = new ServerHelper();
  			servHelp.setupDefaultServers();
  			mServerRecords = servProv.getAllServerRecords();
  		}
  		
  		// Set up this activity's view
  		mWifiOnlyCheckbox = (CheckBox) findViewById(R.id.network_settings_wifi_only_checkbox);
  		if (prefs.getBoolean(WIFI_ONLY_SELECTED, false))
  		{
  			mWifiOnlyCheckbox.setChecked(true);
  		}
  		mWifiOnlyCheckbox.setOnClickListener(new View.OnClickListener() 
          {
          	@Override
  			public void onClick(View v) 
          	{
  	            if (mWifiOnlyCheckbox.isChecked()) 
  	            {
  	            	SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
  	            	SharedPreferences.Editor editor = prefs.edit();
  	    		    editor.putBoolean(WIFI_ONLY_SELECTED, true);
  	    		    editor.commit();
  	    		    
  	    		    Log.i(TAG, "Wifi-only checkbox set to true");
  	            } 
  	            else 
  	            {
  	            	SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
  	            	SharedPreferences.Editor editor = prefs.edit();
  	    		    editor.putBoolean(WIFI_ONLY_SELECTED, false);
  	    		    editor.commit();
  	    		    
  	    		    Log.i(TAG, "Wifi-only checkbox set to false");
  	            }
          	}
          });
  		
  		ServerRecordAdapter adapter = new ServerRecordAdapter(mServerRecords);
          mServersListView = new ListView(this);
          mServersListView = (ListView)findViewById(android.R.id.list);         
          setListAdapter(adapter);
  		
  		mAddNewServerButton = (Button) findViewById(R.id.network_settings_add_new_server_button);
  		mAddNewServerButton.setOnClickListener(new View.OnClickListener()
  		{		
  			@Override
  			public void onClick(View v)
  			{
  				Log.i(TAG, "Add new server button clicked");
  			    
  		        // Open a dialog to enter the data for the new server record
  				final Dialog listItemDialog = new Dialog(NetworkSettingsActivity.this);
  				LinearLayout dialogLayout = (LinearLayout) View.inflate(NetworkSettingsActivity.this, R.layout.dialog_servers_add_new, null);
  				listItemDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
  				listItemDialog.setContentView(dialogLayout);
  				
  				WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
  			    lp.copyFrom(listItemDialog.getWindow().getAttributes());
  			    lp.width = WindowManager.LayoutParams.MATCH_PARENT;
  				
  			    listItemDialog.show();
  			    listItemDialog.getWindow().setAttributes(lp);
  			    
  			    final EditText listItemDialogUrlEditText= (EditText) dialogLayout.findViewById(R.id.network_settings_add_new_server_dialog_url_edittext);
  			    final EditText listItemDialogUsernameEditText = (EditText) dialogLayout.findViewById(R.id.network_settings_add_new_server_dialog_username_edittext);
  			    final EditText listItemDialogPasswordEditText = (EditText) dialogLayout.findViewById(R.id.network_settings_add_new_server_dialog_password_edittext);
  			    
  				if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
  				{
  			        // Show soft keyboard when the URL Edit Text gains focus
  					listItemDialogUrlEditText.setOnFocusChangeListener(new OnFocusChangeListener() 
  				    {
  			            @Override
  			            public void onFocusChange(View v, boolean hasFocus) 
  			            {
  			            	listItemDialogUrlEditText.post(new Runnable() 
  			            	{
  			                    @Override
  			                    public void run() {
  			                        InputMethodManager imm = (InputMethodManager) getBaseContext().getSystemService(Context.INPUT_METHOD_SERVICE);
  			                        imm.showSoftInput(listItemDialogUrlEditText, InputMethodManager.SHOW_IMPLICIT);
  			                    }
  			                });
  			            }
  			        });
  				    
  				    // Show soft keyboard when the Username Edit Text gains focus
  					listItemDialogUsernameEditText.setOnFocusChangeListener(new OnFocusChangeListener() 
  				    {
  			            @Override
  			            public void onFocusChange(View v, boolean hasFocus) 
  			            {
  			            	listItemDialogUsernameEditText.post(new Runnable() 
  			            	{
  			                    @Override
  			                    public void run() {
  			                        InputMethodManager imm = (InputMethodManager) getBaseContext().getSystemService(Context.INPUT_METHOD_SERVICE);
  			                        imm.showSoftInput(listItemDialogUsernameEditText, InputMethodManager.SHOW_IMPLICIT);
  			                    }
  			                });
  			            }
  			        });
  					
  					// Show soft keyboard when the Password Edit Text gains focus
  					listItemDialogPasswordEditText.setOnFocusChangeListener(new OnFocusChangeListener() 
  				    {
  			            @Override
  			            public void onFocusChange(View v, boolean hasFocus) 
  			            {
  			            	listItemDialogPasswordEditText.post(new Runnable() 
  			            	{
  			                    @Override
  			                    public void run() {
  			                        InputMethodManager imm = (InputMethodManager) getBaseContext().getSystemService(Context.INPUT_METHOD_SERVICE);
  			                        imm.showSoftInput(listItemDialogPasswordEditText, InputMethodManager.SHOW_IMPLICIT);
  			                    }
  			                });
  			            }
  			        });
  				}
  			    
  			    Button saveButton = (Button) dialogLayout.findViewById(R.id.network_settings_add_new_server_dialog_save_button);
  			    saveButton.setOnClickListener(new View.OnClickListener()
  				{
  					@Override
  					public void onClick(View v)
  					{
  						Log.i(TAG, "Add new server dialog save button pressed");
  						
  