HeIp me friends... How can i save the taken network location? I got many errors in the saving part of this code
        package com.locatn;
        
        import java.io.File;
        import java.io.IOException;
        import java.io.OutputStream;
        import java.io.OutputStreamWriter;
        import java.io.Writer;
        
        import android.app.Activity;
        import android.content.Context;
        
        import android.location.LocationManager;
        import android.os.Bundle;
        import android.os.Environment;
        
            import android.widget.Toast;
            
            public class Location extends Activity {
                private LocationManager locationManagerNetwork;
            
            	
                @Override
                public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.main);
            
                
                locationManagerNetwork = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
                android.location.Location location2 = locationManagerNetwork
                                .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
             if (location2 != null) {   `enter code here`    
                        String message = String
                                .format("Yout location : \n Longitude: %1$s \n Latitude: %2$s",
                                        location2.getLongitude(), location2.getLatitude());
                        Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG)
                                .show();
        
 //    **I am getting many errors in the saving part of this code.  
     Friends please help me to correct this code. 
     I want to save the taken location info as a txt file and save it to SD card. 
    Please help me friends** //
        
                
                *public class WriteTextFileExample{
                	  public static void main(String[] args)throws IOException{
                	  Writer output = null;
                	  
                	  File sdcard = Environment.getExternalStorageDirectory();
                	  File file = new File("/sdcard/andsecure/mysdfile.txt");
                	  output = new BufferedWriter(new FileWriter(location2));
                	  output.write(text);
                	  output.close();***
                	   
                	  }
                	 }
                
               
                       }
                     }
            
        
        	   }


HeIp me friends... How can i save the taken network location? I got many errors in the saving part of this code
===

        package com.locatn;
        
        import java.io.File;
        import java.io.IOException;
        import java.io.OutputStream;
        import java.io.OutputStreamWriter;
        import java.io.Writer;
        
        import android.app.Activity;
        import android.content.Context;
        
        import android.location.LocationManager;
        import android.os.Bundle;
        import android.os.Environment;
        
            import android.widget.Toast;
            
            public class Location extends Activity {
                private LocationManager locationManagerNetwork;
            
            	
                @Override
                public void onCreate(Bundle savedInstanceState) {
                    super.onCreate(savedInstanceState);
                    setContentView(R.layout.main);
            
                
                locationManagerNetwork = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
                android.location.Location location2 = locationManagerNetwork
                                .getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
             if (location2 != null) {   `enter code here`    
                        String message = String
                                .format("Yout location : \n Longitude: %1$s \n Latitude: %2$s",
                                        location2.getLongitude(), location2.getLatitude());
                        Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG)
                                .show();
        
 //    **I am getting many errors in the saving part of this code.  
     Friends please help me to correct this code. 
     I want to save the taken location info as a txt file and save it to SD card. 
    Please help me friends** //
        
                
                *public class WriteTextFileExample{
                	  public static void main(String[] args)throws IOException{
                	  Writer output = null;
                	  
                	  File sdcard = Environment.getExternalStorageDirectory();
                	  File file = new File("/sdcard/andsecure/mysdfile.txt");
                	  output = new BufferedWriter(new FileWriter(location2));
                	  output.write(text);
                	  output.close();***
                	   
                	  }
                	 }
                
               
                       }
                     }
            
        
        	   }

