[android-developers] Re: Hi friends
Ibrahim wrote: Friends I Am trying to connect server on pc and client on android device.. Warning: I am not your friend. My server is working fine... but my client is not working ... Here is my sever and client code... Server Code... public class Server_tcp { Please follow the Java naming conventions. void run(){ Why is this method not public? { try { System.out.println(Hi Im In 1st Try); try { System.out.println(Hi Im In 2nd try ); Boolean end = false; Why did you declare this 'Boolean' and not 'boolean'? ServerSocket ss = new ServerSocket(); System.out.println(socket created); while(!end){ //Server is waiting for client here, if needed Socket s = ss.accept(); System.out.println(socket accepted); Calls to 'System.out.println()' are the worst of the available logging options. BufferedReader input = new BufferedReader(new InputStreamReader(s.getInputStream())); PrintWriter output = new PrintWriter(s.getOutputStream(),true); //Autoflush String st = input.readLine(); System.out.println(Tcp Example + From client: +st); output.println(I got the Message:)); output.flush(); Why do you flush an auto-flushed stream? s.close(); if (st==null){ end = true; } } ss.close(); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); Handle errors, don't ignore them. } } catch (IOException exp) { // TODO Auto-generated catch block exp.printStackTrace(); } } } public static void main(String args[]) { Server_tcp server = new Server_tcp(); while(true){ server.run(); So you restart the server every time you choose to close it. Hmm. } } } Client Code public class ClientTCPActivity extends Activity { /** Called when the activity is first created. */ private EditText et; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); System.out.println(Before try net); Run(); Please follow the Java naming conventions. System.out.println(after try net); } public void Run() { System.out.println(inside try net); try { System.out.println(inside try); Socket s = new Socket(192.168.1.27,); //outgoing stream redirect to socket // OutputStream out = (OutputStream) et.getContentDescription(); PrintWriter output = new PrintWriter(s.getOutputStream(),true); output.println(Hello Android!); BufferedReader input = new BufferedReader(new InputStreamReader(s.getInputStream())); //read line(s) String st = input.readLine(); System.out.println(st); //Close connection s.close(); System.out.println( try ); } catch (UnknownHostException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } My Client is not working properly my friends What does that mean? In other words, what did you expect, and what happened instead? Copy and paste messages; do not paraphrase them. Can Any One help me ??? You only need one question mark at the end of an interrogative sentence. And no, not without sufficient information. -- Lew -- -- 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 --- You received this message because you are subscribed to the Google Groups Android Developers group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. For more options,
Re: [android-developers] Re: hi friends
I believe this is the relevant code where the real toast delay is set: private void scheduleTimeoutLocked(ToastRecord r, boolean immediate) { Message m = Message.obtain(mHandler, MESSAGE_TIMEOUT, r); long delay = immediate ? 0 : (r.duration == Toast.LENGTH_LONG ? LONG_DELAY : SHORT_DELAY); mHandler.removeCallbacksAndMessages(r); mHandler.sendMessageDelayed(m, delay); } If you passed in 3000, because 3000 != Toast.LENGTH_LONG, you get a SHORT_DELAY, which is 2 seconds: private static final int SHORT_DELAY = 2000; // 2 seconds IOTW, the code is not expecting milliseconds at all. If you do pass in milliseconds, it will currently do a 2 second delay. No guarantee as to what will happen in future releases though. On Monday, January 7, 2013 10:19:24 PM UTC-6, sree wrote: 3000 meand 3 milly seconds(1000 seconds for 1ms).It is correct. -- 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
Re: [android-developers] Re: hi friends
Well, it seems like if you pass 3000 for the duration, it does show. But the docs don't seem to condone this. On Tuesday, January 8, 2013 9:21:33 AM UTC-6, bob wrote: *duration* How long to display the message. Either LENGTH_SHORThttp://developer.android.com/reference/android/widget/Toast.html#LENGTH_SHORT or LENGTH_LONGhttp://developer.android.com/reference/android/widget/Toast.html#LENGTH_LONG On Monday, January 7, 2013 10:19:24 PM UTC-6, sree wrote: 3000 meand 3 milly seconds(1000 seconds for 1ms).It is correct. -- 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
Re: [android-developers] Re: hi friends
bob wrote: Well, it seems like if you pass 3000 for the duration, it does show. But the docs don't seem to condone this. And the docs make quite clear that the unit is not milly seconds [sic]. Or do we think 1 millisecond is a long time? bob wrote: *duration* How long to display the message. Either LENGTH_SHORThttp://developer.android.com/reference/android/widget/Toast.html#LENGTH_SHORT or LENGTH_LONGhttp://developer.android.com/reference/android/widget/Toast.html#LENGTH_LONG sree wrote: 3000 meand 3 milly seconds(1000 seconds for 1ms).It is correct. Except for the fact that that argument does not take milliseconds. -- Lew -- 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
Re: [android-developers] Re: hi friends
*duration* How long to display the message. Either LENGTH_SHORThttp://developer.android.com/reference/android/widget/Toast.html#LENGTH_SHORT or LENGTH_LONGhttp://developer.android.com/reference/android/widget/Toast.html#LENGTH_LONG On Monday, January 7, 2013 10:19:24 PM UTC-6, sree wrote: 3000 meand 3 milly seconds(1000 seconds for 1ms).It is correct. -- 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
[android-developers] Re: hi friends
check for internet connection by this method if its returns true then eecute your code. public boolean isNetworkAvailable() { ConnectivityManager connectivityManager = (ConnectivityManager) getSystemService (Context.CONNECTIVITY_SERVICE); NetworkInfo activeNetworkInfo = connectivityManager.getActiveNetworkInfo(); return activeNetworkInfo != null; } -- 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
[android-developers] Re: hi friends
Please make sure the second parameter to Toast.makeText is correct. Hint: it should not be 3000. On Monday, January 7, 2013 2:19:48 AM UTC-6, sree wrote: Hi friends, Please see above attachments, In image one i am using imageview,button,textview. when i click button text is strikeing,but when i ckick on text tost is not working. In image two i am using imageview,textview. when i click on text tost is working.here i removed only button,i cant change any code. why like this.please give me replay -- 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
Re: [android-developers] Re: hi friends
3000 meand 3 milly seconds(1000 seconds for 1ms).It is correct. -- 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
[android-developers] Re: hi friends
Try connecting to a socket where there is a server listening. On Friday, January 4, 2013 7:49:38 AM UTC-6, sree wrote: How can i fix SocketTimeoutException: Connection timed out give me any suggession. -- 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
[android-developers] Re: hi friends
In addition to what bob says: SocketTimeoutException is an IOException. There's a whole bunch of stuff that can go wrong when it comes to IO. The Internet connection could be down, the server you want to contact could be down, the response from the server could be faulty, etc. etc. Your code needs to be able to deal with these problems. Catch the exception and present the user with an error message and provide a retry button. You also may want to check the network connectionhttp://developer.android.com/reference/android/net/ConnectivityManager.htmlif it's currently up and usable. On Friday, January 4, 2013 7:49:38 AM UTC-6, sree wrote: How can i fix SocketTimeoutException: Connection timed out give me any suggession. -- 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
[android-developers] Re: hi friends
sree wrote: i [sic] am reading date value from webservices (DD/MM/) and set these date to textview.After Displaying the values is show like DD/MM/.Here i can store reading date value in one array and these array is bind to textview. But i want to display DD/MM only how. plz [sic] help me What is plz? That is not an English word. Use java.text.DateFormat or android.text.format.DateFormat to create the strings for the view. -- Lew -- 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
Re: [android-developers] Re: hi friends
thank you friend. -- 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
[android-developers] Re: hi friends
TEXTVIEW (TEXTVIEW | TEXTVIEW | TEXTVIEW) -- 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
[android-developers] Re: hi friends
I Got solution for this,Thank you no need to explain it. TEXTVIEW (TEXTVIEW | TEXTVIEW | TEXTVIEW) -- 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
[android-developers] Re: hi friends
sree wrote: I Got solution for this,Thank you no need to explain it. Yes, there is. Please do. TEXTVIEW (TEXTVIEW | TEXTVIEW | TEXTVIEW) -- Lew -- 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
[android-developers] Re: hi friends
sree android wrote: Hi friends i am reading date value from webservices (DD/MM/) and set these date to textview.After Displaying the values is show like DD/MM/.Here i can store reading date value in one array and these array is bind to textview. But i want to display DD/MM only how. plz help me http://developer.android.com/reference/java/text/SimpleDateFormat.html pskink -- 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
[android-developers] Re: hi friends
sree android wrote: Hi friends, The above attachment i prepared ListView with Sections,Here i need to call Custom Listview inside sections.It is posible or not. If it is possible how can i do.please give me stepts or any code links. thank you in advance. what do you mean by need to call Custom Listview inside sections? pskink -- 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
[android-developers] Re: hi friends
I am asking customlistview inside customlistview.It is possible or not.If it is possible How. The above attachements are implemented with customlistview using webservices. -- 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
[android-developers] Re: hi friends
sree android wrote: I am asking customlistview inside customlistview.It is possible or not.If it is possible How. you can't add a listview inside another listview, you can add only non scrollable views pskink -- 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
[android-developers] Re: hi friends
sree android wrote: Happy New Year to One And All. Please suggest me, The above attached image,How can i display that items.How can i add items particularly in Today or Tomarrow Textviews and also the line below of Today textview. Please send me replay with which concept is used and how. It's a ListView with sections. -- 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
[android-developers] Re: hi friends
Please see this page: http://developer.android.com/guide/topics/ui/layout/gridview.html It describes what you want to do using resources. You just need to modify it to use the SD card. On Tuesday, December 4, 2012 4:06:17 AM UTC-6, sree wrote: help me.i would like to display images in gridview from sd card specific folder. any body have any idea,give me please. -- 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
[android-developers] Re: hi friends
Thank you bro. -- 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