title: Printing on Emulator
body: <p>I am newbie to android. I am working on a project wherein I need to give directional info on the android mobile. So, I have to see directional messages on my android screen. I had written the code in normal java and compiled, executed on Command prompt. I was able to see the output of the print statements which I had given in my code. So, I created a new android project and then created another class and pasted my code there. To my surprise, I don't find the print statements on the emulator screen. Moreover, when I tried to do the same last evening, I was able to see the print statements on the console window of eclipse. But I don't see the same now. Can you please explain how to make my print statements appear on the emulator screen. At the same time, pls let me know why I was able to see those print statements on the console window of eclipse and what should I do to replicate the same? I can see only Hello World on the emulator screen.</p>
  
  <p>Below is the piece of code:</p>
  
  <p>`package com.example.visual;</p>
  
  <pre><code>import org.json.JSONObject;
  import org.restlet.data.ChallengeScheme;
  import org.restlet.ext.json.JsonRepresentation;
  import org.restlet.resource.ClientResource;
  import android.widget.Toast;
  import android.app.Activity;
  
  public class ItsClient4 extends Activity {
  
  private final static String BASE_URL = "my website url";
  private final static String SITE_ID = "67";// Your site ID here
  private final static String STATION_MAC[] = {"mac1","mac2"};// The station's MAC address
  private final static String NODES[] = {"mac3","mac4","mac5","mac6","mac7","mac8"};
  private final static String USERNAME = "usrname";// Your username
  private final static String PASSWORD = "pwd";// Your password
  public static void main(String[] args) throws Exception {
  // Set the request parameters
  while(true){
  double c[]=new double[6];
  double d[]=new double[6];
  String url[] =new String[2];
  ClientResource itsClient[] = new ClientResource[2];
  JsonRepresentation jsonRep[] = new JsonRepresentation[2];
  for(int i=0;i&lt;=0;i++){
  
  url[i] = BASE_URL + "sites/" + SITE_ID + "/stations/"+ STATION_MAC[i] + "/";
  
  itsClient[i] = new ClientResource(url[i]);
                   itsClient[i].setChallengeResponse(ChallengeScheme.HTTP_BASIC, USERNAME, PASSWORD);
  // Retrieve and parse the JSON representation
  jsonRep[i] = new JsonRepresentation(itsClient[i].get());
  JSONObject jsonObj = jsonRep[i].getJsonObject();
  // Output results
  
  c[i]=jsonObj.getJSONObject("loc").getDouble("lat");
  d[i]=jsonObj.getJSONObject("loc").getDouble("lng");
  
  Toast.makeText(ItsClient4.this,"text",20000).show();
  //Toast.makeText(ItsClient4.this, "Hello", Toast.LENGTH_LONG).show();
  System.out.println(c[i] +" "+d[i]);
  if(d[i]&gt;78.142182){
  System.out.println("near E8");
  }
  }
  
  
  }
  }
  }
  </code></pre>
  
  <p>`</p>
  
  <p>Pls check the above code and pls help me how to use Toast. Its still giving me the error "cannot use this in a static context". In my package "visual", in the src directory, com.example.visual has two sub-directories. One is the MainActivity.java and the other is ItsClient4.java. MainActivity.java is automatically created one.I have created ItsClient4.java by adding a new Class in the com.example.visual directory. Pls tell me how to overcome the above error.</p>
  
  <p>Can't I use the Toast inside Main function?</p>