Hey Can you please tell me what kind of server did you setup for this code...I am trying to do something similiar on my apche tomcat server...but in order to do that i nedd to install php on my tomcat...but I am not able to do this...any help would be great about server setup since I have little knowledge about servers..thanx
On Tuesday, November 20, 2012 7:43:41 AM UTC-5, Antonis Kanaris wrote: > > > > I am new android developer. > > I am trying this code for access data from my webserver.... > > @Overridepublic void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.activity_main); > > URL url; > try { > url = new URL("http://www.mysite.net/LEDstate.txt"); > > HttpURLConnection urlConnection = (HttpURLConnection) url > .openConnection(); > > InputStream in = urlConnection.getInputStream(); > > InputStreamReader isw = new InputStreamReader(in); > > int data = isw.read(); > while (data != -1) { > char current = (char) data; > data = isw.read(); > //System.out.print(current); > > > TextView t = (TextView) findViewById(R.id.ledstate); > > t.setText(current); > } > } catch (Exception e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > } > @Overridepublic boolean onCreateOptionsMenu(Menu menu) { > getMenuInflater().inflate(R.menu.activity_main, menu); > return true;} > > } > > But data is not appearing on Screen.There is no change in Textview. > > I have checked Permissions they are ok. > > Any help? Thanks. > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en