What i must add to this code
public void appendText(View view){
Text.append( "\n In chat ");
try{
// while (true)
//{
sentence=inputfld.getText().toString();
sentence1="ingyyyy";
Text.append( "\n DataStream creating");
outToServer.writeBytes(sentence);
outToServer.writeBytes(sentence1);
modifiedSentence = inFromServer.readLine();
Text.append(modifiedSentence);
inputfld.setText(null);
//if(modifiedSentence.equals("QUIT"))
//break;
// }
}
catch(Exception modifiedsentence){
Text.append("Exception");
}
}
public void connect(View view){
try{
clientSocket= new Socket("192.168.1.3",54637);
Text.append( "\n created a socket");
outToServer = new
DataOutputStream(clientSocket.getOutputStream());
Text.append( "\n created a datastream");
inFromServer = new BufferedReader(new
InputStreamReader(clientSocket.getInputStream()));
Text.append( "\n created a bufferReader");
outToServer = new
DataOutputStream(clientSocket.getOutputStream());
try{
Thread listen = new Thread(new
clientThread(clientSocket));
listen.start();
}catch(Exception e){}
// Connect.setVisibility(1);
// Text.append( "\n remove connect button");
// Enter.setVisibility(0);
}catch(Exception e){
System.out.println("Error");
}
}
}
to solve the thread problem ??
On May 27, 10:56 pm, Miguel Morales <[email protected]> wrote:
> You need to
> read:http://developer.android.com/resources/articles/painless-threading.html
>
> Also, put some more effort into your questions don't just dump some log
> text.
>
>
>
>
>
>
>
>
>
> On Fri, May 27, 2011 at 1:46 PM, ingy abbas <[email protected]> wrote:
> > 05-27 23:34:12.933: INFO/ActivityThread(311): Pub
> > com.android.deskclock: com.android.deskclock.AlarmProvider
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): ANR in yaraby.y
> > (yaraby.y/.yaraby)
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): Reason:
> > keyDispatchingTimedOut
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): Load: 0.17 / 1.97 /
> > 1.47
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): CPU usage from 3844ms
> > to -1833ms ago:
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): 20% 61/system_server:
> > 11% user + 8.6% kernel / faults: 366 minor 4 major
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): 1% 126/zygote: 0.1%
> > user + 0.8% kernel / faults: 142 minor
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): 1% 128/zygote: 0.3%
> > user + 0.7% kernel / faults: 107 minor
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): 0% 415/yaraby.y: 0%
> > user + 0% kernel / faults: 80 minor 7 major
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): 0.7% 40/adbd: 0% user
> > + 0.7% kernel
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): 0% 13/kswapd0: 0%
> > user + 0% kernel
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): 0.1% 37/qemud: 0%
> > user + 0.1% kernel
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): 0% 425/logcat: 0%
> > user + 0% kernel
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): 33% TOTAL: 16% user +
> > 16% kernel + 0.2% softirq
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): CPU usage from 1100ms
> > to 1759ms later:
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): 16% 61/system_server:
> > 6.1% user + 10% kernel / faults: 12 minor
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): 13% 92/
> > InputDispatcher: 6.1% user + 7.6% kernel
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): 1.5% 62/HeapWorker:
> > 0% user + 1.5% kernel
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): 1.5% 69/
> > SurfaceFlinger: 1.5% user + 0% kernel
> > 05-27 23:40:10.814: ERROR/ActivityManager(61): 38% TOTAL: 19% user +
> > 19% kernel
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> ~ Jeremiah:9:23-24
> Android 2D MMORPG:http://solrpg.com/,http://www.youtube.com/user/revoltingx
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en