i managed to reach that error line. but when the control is in that position, what is the information that i should be looking out for.. I dont find anything relating the error iin any of the screens....
On Apr 8, 2:32 am, "Tommy" <[email protected]> wrote: > When the Source code not found error comes up have you hit F7? That should > step over that java source code for android that you don't have(not a > problem) and return you back to your code. Then you can hit F5 until it > comes back to Source code not found. let me know what happens. If you feel > like providing me a private email address feel free to. > > -----Original Message----- > From: [email protected] > > [mailto:[email protected]] On Behalf Of raqz > Sent: Thursday, April 08, 2010 2:27 AM > To: Android Developers > Subject: [android-developers] Re: Trying to start a thread dedicated to > sending and receiving data > > Tommy, thanks for helping me out man. I just tried debugging. I > entered android:debuggable="true" in the manifest and started > debugging. I placed a breakpoint at the beginning of the code so that > I can see what happens right from the start. But the output just says > "Source not found" Class file Editor. I dont know what is going wrong. > Would you mind helping me out one time. I can share my system with > you. > > On Apr 8, 2:14 am, "Tommy" <[email protected]> wrote: > > when that happens hit F7 one time. It should pop you back out to your > code. > > Then hit F5 until you get that screen...Rinse and repeat :) > > > -----Original Message----- > > From: [email protected] > > > [mailto:[email protected]] On Behalf Of raqz > > Sent: Thursday, April 08, 2010 2:10 AM > > To: Android Developers > > Subject: [android-developers] Re: Trying to start a thread dedicated to > > sending and receiving data > > > I started it in debug mode. But when I click on 'f5' it says Source > > Not Found > > > On Apr 8, 1:55 am, "Tommy" <[email protected]> wrote: > > > Well in order to help I need to know what is causing the > > > NullPointerException. You need to set up a break point at the start of > > your > > > code and step through(f5) Keep an eye on the code b/c at some point it > > will > > > error out and the line of code it was on right before then is the one > > giving > > > the issue. > > > > -----Original Message----- > > > From: [email protected] > > > > [mailto:[email protected]] On Behalf Of raqz > > > Sent: Thursday, April 08, 2010 1:47 AM > > > To: Android Developers > > > Subject: [android-developers] Re: Trying to start a thread dedicated to > > > sending and receiving data > > > > The errors are as below > > > > java.lang.NullPointerException > > > at com.getFriends.ConnectSocket.sendData(ConnectSocket.java:43) > > > > I am not sure why its giving such an error. > > > > Please help. > > > > Thanks, > > > Raqeeb > > > > On Apr 8, 1:41 am, "Tommy" <[email protected]> wrote: > > > > What line does the debug catch the error? Have you stepped through to > > see > > > > what line causes the exception to throw? > > > > > -----Original Message----- > > > > From: [email protected] > > > > > [mailto:[email protected]] On Behalf Of raqz > > > > Sent: Thursday, April 08, 2010 1:37 AM > > > > To: Android Developers > > > > Subject: [android-developers] Trying to start a thread dedicated to > > > sending > > > > and receiving data > > > > > Hi, > > > > > I have a main class activity that does the task of sending control to > > > > other activities on click of a button. I am also starting a thread in > > > > the main class. This thread basically sets up a connection with the > > > > server and is active throughout the lifetime of the application. > > > > I have two functions in the thread class, send and receive data from > > > > server. Therefore, when the other activities need to send/receive data > > > > from server, they use those particular functions. > > > > First of all please let me know if what I am trying to do is fine as > > > > per the architecture of the operating system. If its fine, when I try > > > > to run the code, the app crashes and i see a NullPointerException and > > > > a RuntimeException in the DDMS log. > > > > Could some one please help me out in this or suggest a better way to > > > > implement the concept. > > > > Also, please be assured that, the other functionality of the code > > > > works perfectly fine. > > > > The main class code is as below > > > > [code] > > > > package com.getfriends; > > > > > import java.util.ArrayList; > > > > import java.util.Iterator; > > > > import java.util.List; > > > > import java.util.StringTokenizer; > > > > import android.app.Activity; > > > > import android.app.ListActivity; > > > > import android.os.Bundle; > > > > import android.widget.ArrayAdapter; > > > > import android.widget.ListView; > > > > import android.widget.Toast; > > > > > public class GetFriendsActivity extends Activity{ > > > > > private MyFriend obj= new MyFriend(); > > > > List<MyFriend> listOfFriends = new > > ArrayList<MyFriend>(); > > > > > int i=0; > > > > private String FName=null; > > > > private String LName=null; > > > > private String Latitude=null; > > > > private String Longitude=null; > > > > private String TimeStamp=null; > > > > public static ArrayList<String> namesArray=new > > > > ArrayList<String>(); > > > > > public void onCreate(Bundle savedInstanceState) { > > > > super.onCreate(savedInstanceState); > > > > Thread cThread= null; > > > > try{ > > > > cThread = new Thread(new ConnectSocket()); > > > > cThread.start();} > > > > catch (Exception e){ > > > > Toast.makeText(getBaseContext(), > > > > "Unable to start thread", > > > > Toast.LENGTH_LONG).show(); > > > > > } > > > > Toast.makeText(getBaseContext(), > > > > "Starting", > > > > Toast.LENGTH_LONG).show(); > > > > > try { > > > > getFriendsList(); > > > > } catch (Exception e) { > > > > Toast.makeText(getBaseContext(), > > > > "Unable to fetch friend > > list:"+e.getMessage(), > > > > Toast.LENGTH_LONG).show(); > > > > e.printStackTrace(); > > > > } > > > > try { > > > > displayFriendsList(); > > > > } catch (Exception e) { > > > > Toast.makeText(getBaseContext(), > > > > "Unable to display friend > > > list:"+e.getMessage() > > > > +e.getLocalizedMessage(), > > > > Toast.LENGTH_LONG).show(); > > > > e.printStackTrace(); > > > > } > > > > ConnectSocket socket = new ConnectSocket(); > > > > > socket.sendData("ABCDEF"); > > > > String k = socket.recieveData(); > > > > Toast.makeText(getBaseContext(), > > > > "Recieved from server:"+k, > > > > Toast.LENGTH_LONG).show(); > > > > > } > > > > > private void getFriendsList() { > > > > > String line[] = new String[3]; > > > > line[0]= > > > > "Abdul#Raqeeb#23.44#34.44#4.45"; > > > > line[1]= > > > > "Abdul#Azeez#33.44#44.44#5.45"; > > > > line[2]= > > > > "Kiral#Azeez#53.44#454.44#6.45"; > > > > for(int k=0;k<=2;k++){ > > > > StringTokenizer tokens=new > > > > StringTokenizer(line[k],"#"); > > > > try{ > > > > while(tokens.hasMoreTokens()) > > > > { > > > > FName=tokens.nextToken(); > > > > LName=tokens.nextToken(); > > > > Latitude=tokens.nextToken(); > > > > Longitude=tokens.nextToken(); > > > > TimeStamp=tokens.nextToken(); > > > > listOfFriends.add(new > > > > MyFriend(FName,LName,Latitude,Longitude,TimeStamp)); > > > > } > > > > } > > > > catch (Exception e){ > > > > Toast.makeText(this, > > > > "Some prob > > > > here:"+e.getLocalizedMessage(), > > > > > Toast.LENGTH_SHORT).show(); > > > > e.printStackTrace(); > > > > } > > > > } > > > > > } > > > > > } > > > > > [/code] > > > > > The code related to the thread is > > > > [code] > > > > package com.getfriends; > > > > > import java.io.BufferedReader; > > ... > > read more » -- 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

