Originally Posted By: mkwan	
Group: Michael, Gayathri, Sayali, Amruta
Problem 8 solution:
1. Android:Code:  Log.i("TooSmallApp", "It's cramped in here");
2. iOS: Code: NSLog(@"TooSmallApp: It's cramped in here");
Problem 10 Android solution:
1. Add the following to AndroidManifest.xml:
Code: 
2. Then create this class:
Code: public class MailTestActivity extends Activity {
   private final static String MAIL_COMMAND = "HELO my.mailserver.org";
   private final static String DESTINATION_ADDRESS = "my.mailserver.org";   
   private final static int DESTINATION_PORT = 25;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        Socket connection = null;
        DataOutputStream outputStream = null;
        
        // This is needed for SDK 9 and above when opening sockets in the main thread.
        ThreadPolicy tp = ThreadPolicy.LAX;
        StrictMode.setThreadPolicy(tp);        
        
        try {
         connection = new Socket(DESTINATION_ADDRESS, DESTINATION_PORT);
         outputStream = new DataOutputStream(connection.getOutputStream());
         outputStream.writeUTF(MAIL_COMMAND);
      } catch (UnknownHostException e) {
         Log.d("MailTest", "Unable to connect to " + DESTINATION_ADDRESS + ":" + DESTINATION_PORT);
         e.printStackTrace();
      } catch (IOException e) {
         Log.d("MailTest", "Unable to get IO stream");
         e.printStackTrace();
      } finally
      {      
         try {
            outputStream.close();
            connection.close();
         } catch (IOException e) {
            e.printStackTrace();
         }         
      }        
    }
}
                 
                                    '''Originally Posted By: mkwan'''
Group: Michael, Gayathri, Sayali, Amruta<br><br>Problem 8 solution:<br>1. Android:Code:  Log.i("TooSmallApp", "It's cramped in here");<br>2. iOS: Code: NSLog(@"TooSmallApp: It's cramped in here");<br><br>Problem 10 Android solution:<br>1. Add the following to AndroidManifest.xml:<br>Code: <br><br>2. Then create this class:<br>Code: public class MailTestActivity extends Activity {<br>   private final static String MAIL_COMMAND = "HELO my.mailserver.org";<br>   private final static String DESTINATION_ADDRESS = "my.mailserver.org";   <br>   private final static int DESTINATION_PORT = 25;<br>    /** Called when the activity is first created. */<br>    @Override<br>    public void onCreate(Bundle savedInstanceState) {<br>        super.onCreate(savedInstanceState);<br>        setContentView(R.layout.main);<br>        <br>        Socket connection = null;<br>        DataOutputStream outputStream = null;<br>        <br>        // This is needed for SDK 9 and above when opening sockets in the main thread.<br>        ThreadPolicy tp = ThreadPolicy.LAX;<br>        StrictMode.setThreadPolicy(tp);        <br>        <br>        try {<br>         connection = new Socket(DESTINATION_ADDRESS, DESTINATION_PORT);<br>         outputStream = new DataOutputStream(connection.getOutputStream());<br>         outputStream.writeUTF(MAIL_COMMAND);<br>      } catch (UnknownHostException e) {<br>         Log.d("MailTest", "Unable to connect to " + DESTINATION_ADDRESS + ":" + DESTINATION_PORT);<br>         e.printStackTrace();<br>      } catch (IOException e) {<br>         Log.d("MailTest", "Unable to get IO stream");<br>         e.printStackTrace();<br>      } finally<br>      {      <br>         try {<br>            outputStream.close();<br>            connection.close();<br>         } catch (IOException e) {<br>            e.printStackTrace();<br>         }         <br>      }        <br>    }<br>}<br>