[android-developers] app working in simulator but not in phone
i have this app that i developed and it works great on the simulator with no errors what so ever. but the moment i try to run the same on the phone for testing, the app crashes stating filenotfoundexception. it says the file /res/drawable/divider_horizontal.9.png is missing. but actually speaking, i have never referenced that file through my code. i believe its a system/os file that is unavailable. i have a custom list view, i guess its the divider there... could somebody please suggest what is wrong here. i believe this is a similar issue discussed here..but i am unable to make any sense out of it http://code.google.com/p/transdroid/issues/detail?id=14 the listview.xml layout file http://schemas.android.com/apk/res/ android" android:layout_height="wrap_content" android:gravity="left| center" android:layout_width="wrap_content" android:paddingBottom="5px" android:paddingTop="5px" android:paddingLeft="5px" > the main xml file that calls the listview.xml http://schemas.android.com/apk/res/ android" android:layout_width="fill_parent" android:layout_height="fill_parent"> and the code for the same is private class EfficientAdapter extends BaseAdapter{ private LayoutInflater mInflater; private String eventTitleArray[]; private String eventDateArray[]; private String eventImageLinkArray[]; public EfficientAdapter(Context context,String[] eventTitleArray,String[] eventDateArray, String[] eventImageLinkArray) { mInflater = LayoutInflater.from(context); this.eventDateArray=eventDateArray; this.eventTitleArray=eventTitleArray; this.eventImageLinkArray =eventImageLinkArray; } public int getCount(){ //return XmlParser.todayEvents.size()-1; return this.eventDateArray.length; } public Object getItem(int position){ return position; } public long getItemId(int position){ return position; } public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if(convertView == null){ convertView = mInflater.inflate(R.layout.listview,null); holder = new ViewHolder(); holder.firstLine = (TextView) convertView.findViewById(R.id.firstLineView); holder.secondLine = (TextView) convertView.findViewById(R.id.secondLineView); holder.imageView = (ImageView) convertView.findViewById(R.id.linkImage); //holder.checkbox = (CheckBox) convertView.findViewById(R.id.star); holder.firstLine.setFocusable(false); holder.secondLine.setFocusable(false); holder.imageView.setFocusable(false); //holder.checkbox.setFocusable(false); convertView.setTag(holder); }else{ holder = (ViewHolder) convertView.getTag(); } Log.i(tag, "Creating the list"); holder.firstLine.setText(this.eventTitleArray[position]); holder.secondLine.setText(this.eventDateArray[position]); Bitmap bitmap; try { bitmap = BitmapFactory.decodeStream((InputStream)new URL("http:// eventur.sis.pitt.edu/images/heinz7.jpg").getContent()); } catch (MalformedURLException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } catch (Exception e1) { // TODO Auto-generated catch block bitmap = BitmapFactory.decodeFile("assets/heinz7.jpg");// decodeFile(getResources().getAssets().open("icon.png")); e1.printStackTrace(); } try { try{ bitmap = BitmapFactory.decodeStream((InputStream)new URL(this.eventImageLinkArray[position]).getContent());} catch(Exception e){ bitmap = BitmapFactory.decodeStream((InputStream)new URL("http:// eventur.sis.pitt.edu/images/heinz7.jpg").getContent()); } int width = 0;
[android-developers] unable to send data to glassfish on netbeans
Hello, I am trying to simple data from an Android service to a GlassFish webserver on netbeans. But when I run the Android program, it sends data but the servlet doesnt pick it up. I have given the correct ip(10.0.2.2), added the path of the servlet in the web.xml file. I am not sure what is going wrong. Could somebody please help me. Servlet protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, JSONException { response.setContentType("text/html;charset=UTF-8"); System.out.println("Server Started Successfully"); PrintWriter out = response.getWriter(); try{ System.out.println(request.getParameterNames()); String param = request.getParameter("Hello"); System.out.println(param+"is the stuff recieved"); System.out.println("Recieved stuff:"+aList.toString()); RequestDispatcher rd = request.getRequestDispatcher("/ MapMatchingServlet"); rd.forward(request, response); } finally { out.close(); } } Android Service Log.i(tag, "Started Get Coordinates"); URL url = new URL("http://10.0.2.2:28503/PNSServer/MainServlet";);// this is the localhost address conn = url.openConnection(); conn.setDoOutput(true); writer = new OutputStreamWriter(conn.getOutputStream()); scanner = new Scanner(new FileReader(new File("/sdcard/ inputdata.txt"))); Log.i(tag, "Read input data"); writer.write("Hello=yes"); Thanks, raqz -- 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] Suggestions - Study on Android development
Hi, I have taken up a course as an independent study on Android Development in my school. I did an assignment which basically included an android device conversing with a servlet. The application in the android device involved usage of a map, list views and fetching current GPS locations. Now to step higher and reaching the advanced level, I would like to know from other's experience as to what would be the other hot topics that I could study about android so as to have a good understanding of how the operating system works and also develop applications to improve my job prospects. Please feel free to suggest. Thanks, raqz -- 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: CheckedListView sparse boolean array
I got the answer for that, we need to increment the for loop till the end of the list that was displayed. the right code would be SparseBooleanArray positions; > positions = listView.getCheckedItemPositions(); > > int j =0; > selected = new String[size]; > > for(int k =0; k if(positions.get(k)){ > selected[j++]=items[k]; > } > > } On Apr 21, 8:03 pm, raqz wrote: > Hi, > > I am trying to use the > android.R.layout.simple_list_item_multiple_choice, with > CHOICE_MODE_MULTIPLE. > The contents are being displayed all right. Even if I happen to select > the items starting from the first item then it works fine. But if in > case, I select the last item ONLY, the program doesnt store the name > in the array selected. > SparseBooleanArray positions; > positions = listView.getCheckedItemPositions(); > > int j =0; > selected = new String[size]; > > for(int k =0; k < positions.size();k++){ > if(positions.get(k)){ > selected[j++]=items[k]; > } > > } > > Please let me know.. > Thanks > Raqeeb > > -- > 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 > athttp://groups.google.com/group/android-developers?hl=en -- 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: Listview with checkbox
Hi, have a look at the below threads as well. http://groups.google.com/group/android-developers/browse_thread/thread/3e6c3c11353f59dc/f9a0c208499cabf6?lnk=gst&q=raqz#f9a0c208499cabf6 http://groups.google.com/group/android-developers/browse_thread/thread/9183cad540114f12/bc2bd993baa20e89?lnk=gst&q=raqz#bc2bd993baa20e89 http://groups.google.com/group/android-developers/browse_thread/thread/9070491729e2a1b9 Thanks, Raqeeb On Apr 21, 4:11 am, "Er. syed imran ali" wrote: > hi all, > i have problem to get event of list view field when i am adding > checkbox in listview. > my problem is to get the status of check box form every row of the > list view, either > it is check or not, according to that i have to do operation. > so, if any one know solution or good tutorial then please reply me, > Thanks and Regards > Imran ali > > -- > 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 > athttp://groups.google.com/group/android-developers?hl=en -- 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] CheckedListView sparse boolean array
Hi, I am trying to use the android.R.layout.simple_list_item_multiple_choice, with CHOICE_MODE_MULTIPLE. The contents are being displayed all right. Even if I happen to select the items starting from the first item then it works fine. But if in case, I select the last item ONLY, the program doesnt store the name in the array selected. SparseBooleanArray positions; positions = listView.getCheckedItemPositions(); int j =0; selected = new String[size]; for(int k =0; k < positions.size();k++){ if(positions.get(k)){ selected[j++]=items[k]; } } Please let me know.. Thanks Raqeeb -- 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: GetLocation of the phone
i have been getting the locations fine...thats not issue..so please be assured that i have set the manifest file right... i just need to send the lcoations to another activity and i am not able to do that i just thought of this...start a service that would collect gps data at regular intervals of time... and then just start my activity that would use getLastKnownLocation() and get the locations.. Can some one please advise if i am going on the right directio n On Apr 19, 12:22 am, Anurag Singh wrote: > Have you set uses permission in manifiest file. > > android:name="android.permission.ACCESS_FINE_LOCATION" /> > > - Anurag Singh > > Hi, > > > > > > > I am trying to retrieve the GPS location of the phone. I believe I > > cannot create an object of the class which stores the location in a > > variable. So that once the class gets instantiated I use a get method > > and retrieve the content in the variable. > > So I am trying to do this > > > locationListener = new MyLocationListener(); > > > lm.requestLocationUpdates( > > LocationManager.GPS_PROVIDER,0,0,locationListener); > > if(!information.equals(null)){ > > Bundle bundle = new Bundle(); > > bundle.putString("hello", information); > > Intent intent = new Intent(LocationActivity.this, > > MainActivity.class); > > intent.putExtras(bundle); > > startActivity(intent); > > } > > > and in the locationlistener class > > > public void onLocationChanged(Location loc) { > > if (loc != null) { > > double lat=loc.getLatitude(); > > double lon=loc.getLongitude(); > > information = " "+lat +lon; > > Toast.makeText(getBaseContext(), > > "Location Changed:"+information, > > Toast.LENGTH_LONG).show(); > > } > > else > > information="bad luck"; > > } > > > The mainactivity then displays that...but its not happening...could > > some one please help me how to get the values of this. > > > Thanks...Raqeeb > > > -- > > 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 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 > athttp://groups.google.com/group/android-developers?hl=en -- 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: GetLocation of the phone
yes.. its getting the locations all right..but i am unable to save the location somwhere so that i can use it later. thats the whole issue I just thought of something... if I start a service that does the onLocationChanged stuffit would get the gps locations and store it (somewhere in the system) and later if i just start an acitivity that would do getLastKnowLocation() , shouldn't that fetch the location for further use. Come some one advise please On Apr 19, 12:22 am, Anurag Singh wrote: > Have you set uses permission in manifiest file. > > android:name="android.permission.ACCESS_FINE_LOCATION" /> > > - Anurag Singh > > Hi, > > > > > > > I am trying to retrieve the GPS location of the phone. I believe I > > cannot create an object of the class which stores the location in a > > variable. So that once the class gets instantiated I use a get method > > and retrieve the content in the variable. > > So I am trying to do this > > > locationListener = new MyLocationListener(); > > > lm.requestLocationUpdates( > > LocationManager.GPS_PROVIDER,0,0,locationListener); > > if(!information.equals(null)){ > > Bundle bundle = new Bundle(); > > bundle.putString("hello", information); > > Intent intent = new Intent(LocationActivity.this, > > MainActivity.class); > > intent.putExtras(bundle); > > startActivity(intent); > > } > > > and in the locationlistener class > > > public void onLocationChanged(Location loc) { > > if (loc != null) { > > double lat=loc.getLatitude(); > > double lon=loc.getLongitude(); > > information = " "+lat +lon; > > Toast.makeText(getBaseContext(), > > "Location Changed:"+information, > > Toast.LENGTH_LONG).show(); > > } > > else > > information="bad luck"; > > } > > > The mainactivity then displays that...but its not happening...could > > some one please help me how to get the values of this. > > > Thanks...Raqeeb > > > -- > > 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 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 > athttp://groups.google.com/group/android-developers?hl=en -- 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] GetLocation of the phone
Hi, I am trying to retrieve the GPS location of the phone. I believe I cannot create an object of the class which stores the location in a variable. So that once the class gets instantiated I use a get method and retrieve the content in the variable. So I am trying to do this locationListener = new MyLocationListener(); lm.requestLocationUpdates( LocationManager.GPS_PROVIDER,0,0,locationListener); if(!information.equals(null)){ Bundle bundle = new Bundle(); bundle.putString("hello", information); Intent intent = new Intent(LocationActivity.this, MainActivity.class); intent.putExtras(bundle); startActivity(intent); } and in the locationlistener class public void onLocationChanged(Location loc) { if (loc != null) { double lat=loc.getLatitude(); double lon=loc.getLongitude(); information = " "+lat +lon; Toast.makeText(getBaseContext(), "Location Changed:"+information, Toast.LENGTH_LONG).show(); } else information="bad luck"; } The mainactivity then displays that...but its not happening...could some one please help me how to get the values of this. Thanks...Raqeeb -- 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] Android Appending Values Received From Server
Hi, I am trying to receive some data from a servlet on to android. It works fine for the first run but if in case I happen to use the same activity again, the previous data is getting appended to the new data. Could some one please tell me what is wrong. Why dont the variables get re initialized in the activity on the second usage of the same Thanks, Raqeeb -- 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] Transfer List of specific objects across intents
Hi, I wish to send a list of type from one activity to another. I dont find a bundle.put.. for such an requirement in the api's. Is there a way somebody could suggest through which I could transfer different kinds of data. Thanks, Raqeeb -- 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] ListActivity issue
Hi, I am to display the list and store the selected items in an array. But I am not able to get the correct items that were selected. Here whenever the user clicks an item, the array is getting updated, irrespective if the user is clicking the item to select it or deselect it. Could some one please help me solve this. I could actually perform an iteration to remove the odd numbered items in the array but I feel that would become an overload on the phone. Is there something for efficient. Please advise. public class MainActivity extends ListActivity { TextView selection; String[] items={"sodium", "O2", "C02", "HCL", "NaCl", "H2So4", "O3", "Ag"}; String names[] = new String[10]; static int i=0; int posarray[] = new int[10]; @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); setListAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_multiple_choice, items)); ListView listView = getListView(); listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); selection=(TextView)findViewById(R.id.selection); } public void onListItemClick(ListView parent, View v, int position, long id) { posarray[i]=position; if(!check(position)) { names[i]= items[position]; } selection.setText(arrayToString(names));i++; } private boolean check(int position) { for(int k=0;khttp://groups.google.com/group/android-developers?hl=en
[android-developers] Re: CheckedTextView tutorial
I used the tutorial and was able to display the list. But as you said To get the selections you would use isItemChecked() on ListView. I need to hardcode the options to check as to whether it was selected or not. This is cumbersome if its a large list. I checked out the various other functions such as listView.getCheckItemIds(); which returns a long array with ids. How would I be able to insert a button field in that layout such that, once the user is done selecting what ever he wishes to, he could just click the button which could send the array of captured item ids to another activity for processing. On Apr 17, 5:21 pm, raqz wrote: > Thats great! Thanks.. I was not able to view > yourhttp://github.com/commonsguy/cw-andtutorials/tree/master/20-Notificat... > but I am looking into the other link that you provided. > > Thanks > > On Apr 17, 5:09 pm, Mark Murphy wrote: > > > > > raqz wrote: > > > Hi, > > > I need to display contents of a list of objects. Capture the selected > > > items and later process it. I have been trying to find a tutorial on > > > net but in vain. > > > Could some one please advise me when can I find a tutorial. > > > I know how to display a list but I want the CheckedTextView option. > > > I use CHOICE_MODE_MULTIPLE in this tutorial from one of my books: > > >http://github.com/commonsguy/cw-andtutorials/tree/master/20-Notificat... > > > However, that is a bit involved, as it's halfway through the book. > > > You can see CHOICE_MODE_MULTIPLE in use here: > > >http://developer.android.com/resources/samples/ApiDemos/src/com/examp... > > > To get the selections you would use isItemChecked() on ListView. > > > -- > > Mark Murphy (a Commons > > Guy)http://commonsware.com|http://twitter.com/commonsguy > > > Warescription: Three Android Books, Plus Updates, One Low Price! > > > -- > > 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 > > athttp://groups.google.com/group/android-developers?hl=en > > -- > 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 > athttp://groups.google.com/group/android-developers?hl=en -- 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: CheckedTextView tutorial
Thats great! Thanks.. I was not able to view your http://github.com/commonsguy/cw-andtutorials/tree/master/20-Notificat... but I am looking into the other link that you provided. Thanks On Apr 17, 5:09 pm, Mark Murphy wrote: > raqz wrote: > > Hi, > > I need to display contents of a list of objects. Capture the selected > > items and later process it. I have been trying to find a tutorial on > > net but in vain. > > Could some one please advise me when can I find a tutorial. > > I know how to display a list but I want the CheckedTextView option. > > I use CHOICE_MODE_MULTIPLE in this tutorial from one of my books: > > http://github.com/commonsguy/cw-andtutorials/tree/master/20-Notificat... > > However, that is a bit involved, as it's halfway through the book. > > You can see CHOICE_MODE_MULTIPLE in use here: > > http://developer.android.com/resources/samples/ApiDemos/src/com/examp... > > To get the selections you would use isItemChecked() on ListView. > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Warescription: Three Android Books, Plus Updates, One Low Price! > > -- > 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 > athttp://groups.google.com/group/android-developers?hl=en -- 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] CheckedTextView tutorial
Hi, I need to display contents of a list of objects. Capture the selected items and later process it. I have been trying to find a tutorial on net but in vain. Could some one please advise me when can I find a tutorial. I know how to display a list but I want the CheckedTextView option. Thanks, Raqeeb -- 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: Steps to transfer a simple object from server to android using XML
Hi, I just tried reading a tutorial and created my app using SAX but its not working for some reason and I have no idea why :) Could some one try helping me Thanks in advance, raqz On Apr 11, 12:23 am, raqz wrote: > Hi, > > Could some one please tell me the basic steps that are required to > transfer a list of objects from a webserver to android and vice versa > using XML. I searched tutorials but found tutorials only for complex > RSS feeds or something like that. > > Thanks, > Raqeeb -- 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 To unsubscribe, reply using "remove me" as the subject.
[android-developers] Steps to transfer a simple object from server to android using XML
Hi, Could some one please tell me the basic steps that are required to transfer a list of objects from a webserver to android and vice versa using XML. I searched tutorials but found tutorials only for complex RSS feeds or something like that. Thanks, Raqeeb -- 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 To unsubscribe, reply using "remove me" as the subject.
[android-developers] Re: Sending/Receiving Lists anroid - webserver
I got your point Bob. Thanks for the detailed post of yours. I better learn to covert this into an xml rather than using objects. Would you have a good tutorial with example which could help me do that. Thanks, Raqeeb On Apr 10, 4:13 pm, Bob Kerns wrote: > You may want to pause at this point, and consider whether this is > REALLY what you want to do. > > There are major limitations involved with using object serialization > this way, that affect you both now and in the future, and you have to > think VERY carefully about the implications of both. > > The object you serialize now can only be read by a system with the > appropriate classes available. If you make changes to those classes, > you have to take specific measures to maintain compatibility. This is > a bit tricky, and can limit the nature and extent of your changes in > the future. > > Further, you it will cost you time and effort to maintain this code, > and to test and verify compatibility, with greater risk of failure to > detect problems. > > Clearly, these problems are worse the longer your serialized objects > will exist. > > Often, a better strategy is to define an XML format as your transport > protocol. This doesn't completely negate all these issues, of course, > but it does allow you to inspect what's going on, and to apply various > standard tools (such as XSLT) for converting and upgrading objects. > > You can persist this XML, or you can in turn treat it as just a > transport mechanism, and persist as relations in a database. Or you > can map from XML to objects (and optionally, objects to relational > database). > > ObjectOutputStream gives you an EXTREMELY tight and opaque coupling > between the code on each side. It is usually to your advantage to use > a looser coupling and more transparency. Especially in a client-server > situation where you don't have control over when clients are upgraded. > > "A moment of convenience, a lifetime of regret!" > > On Apr 9, 10:00 pm, raqz wrote: > > > Hi, > > > I am trying to send a list from the android device to a webserver > > which will receive the list and send it back to the android device. I > > have written the below code and it runs fine if I just send values but > > when I send an object, the app freezes. Could someone please help me > > out in this. -- 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 To unsubscribe, reply using "remove me" as the subject.
[android-developers] Re: Sending/Receiving Lists anroid - webserver
The list is being sent to the server. Its just that the server is not able to receive the list and print it out. PS: The MyFriend class implements Serializable On Apr 10, 1:00 am, raqz wrote: > Hi, > > I am trying to send a list from the android device to a webserver > which will receive the list and send it back to the android device. I > have written the below code and it runs fine if I just send values but > when I send an object, the app freezes. Could someone please help me > out in this. > > Thanks > > Code for client > > package com.httpurl; > > import java.io.BufferedReader; > import java.io.InputStreamReader; > import java.io.ObjectOutputStream; > import java.io.OutputStreamWriter; > import java.net.URL; > import java.net.URLConnection; > import java.util.ArrayList; > import java.util.List; > import java.util.StringTokenizer; > > import android.app.Activity; > import android.os.Bundle; > import android.widget.TextView; > import android.widget.Toast; > > public class MainActivity extends Activity { > public static List listOfFriends = new > ArrayList(); > > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > getFriendsList(); > getconnection(listOfFriends); > setContentView(R.layout.main); > TextView tv = new TextView(this); > tv.setText("hello"); > setContentView(tv); > > } > > public void getFriendsList() { > String FName =null; > String LName =null; > String Latitude =null; > String Longitude =null; > String TimeStamp =null; > > String line[] = new String[3]; > line[0]= "Al#Rb#23.44#34.44#4.45"; > line[1]= "Al#Az#33.44#44.44#5.45"; > line[2]= "Kl#Az#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(); > } > } > > } > > private void getconnection(List list) { > > try{ > URL url = new > URL("http://10.0.2.2/HelloServlet/NewServlet";); > URLConnection conn = url.openConnection(); > conn.setDoOutput(true); > > Toast.makeText(getBaseContext(), > "connection set", > Toast.LENGTH_SHORT).show(); > //OutputStreamWriter writer = new > OutputStreamWriter(conn.getOutputStream()); > ObjectOutputStream out = new > ObjectOutputStream(conn.getOutputStream()); > out.writeObject(list); > > //writer.write("value=hello&anotherValue=how r u"); > out.flush(); > Toast.makeText(getBaseContext(), > "sent the list", > Toast.LENGTH_SHORT).show(); > String line; > BufferedReader reader = new BufferedReader(new > InputStreamReader(conn.getInputStream())); > while ((line = reader.readLine()) != null) { > System.out.println(line); > Toast.makeText(getBaseContext(), > "received from server"+line, > Toast.LENGTH_SHORT).show(); > } > out.close(); > reader.close(); > > } > catch (Exception e){ > > } > > } > > } > > The Server code is > protected void processRequest(HttpServletRequest request, > HttpServletResponse response) > throws ServletExcepti
[android-developers] Sending/Receiving Lists anroid - webserver
Hi, I am trying to send a list from the android device to a webserver which will receive the list and send it back to the android device. I have written the below code and it runs fine if I just send values but when I send an object, the app freezes. Could someone please help me out in this. Thanks Code for client package com.httpurl; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.ObjectOutputStream; import java.io.OutputStreamWriter; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity { public static List listOfFriends = new ArrayList(); /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getFriendsList(); getconnection(listOfFriends); setContentView(R.layout.main); TextView tv = new TextView(this); tv.setText("hello"); setContentView(tv); } public void getFriendsList() { String FName =null; String LName =null; String Latitude =null; String Longitude =null; String TimeStamp =null; String line[] = new String[3]; line[0]= "Al#Rb#23.44#34.44#4.45"; line[1]= "Al#Az#33.44#44.44#5.45"; line[2]= "Kl#Az#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(); } } } private void getconnection(List list) { try{ URL url = new URL("http://10.0.2.2/HelloServlet/NewServlet";); URLConnection conn = url.openConnection(); conn.setDoOutput(true); Toast.makeText(getBaseContext(), "connection set", Toast.LENGTH_SHORT).show(); //OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream()); ObjectOutputStream out = new ObjectOutputStream(conn.getOutputStream()); out.writeObject(list); //writer.write("value=hello&anotherValue=how r u"); out.flush(); Toast.makeText(getBaseContext(), "sent the list", Toast.LENGTH_SHORT).show(); String line; BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); while ((line = reader.readLine()) != null) { System.out.println(line); Toast.makeText(getBaseContext(), "received from server"+line, Toast.LENGTH_SHORT).show(); } out.close(); reader.close(); } catch (Exception e){ } } } The Server code is protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, ClassNotFoundException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); ObjectInputStream ois = new ObjectInputStream(request.getInputStream()); List list = (List) ois.readObject(); Iterator itr = list.iterator(); while(itr.hasNext()){ MyFriend obj = (MyFriend) itr.next(); out.println("recived:"+obj.getFName()); } String value2 = request.getParameter("anotherValue"); try { //out.println(""); //out.println(""); //out.println("Servlet NewServlet"); //out.println(""); //out.println(""); //out.println("Servlet NewServlet at " + request.getContextPath () + ""); //out.println("recived"+value+" nextvalue"+value2); //out.println(""); //out.println(""); } f
[android-developers] Receive data in a serlvet
Hi, I am using a urlconnection method to connect to a server (here localhost) which has a servlet running (HelloServlet). Could some one please tell me how do I receive the contents that the client wrote on the outputstream. Here is my client code try{ URL url = new URL("http://10.0.2.2/HelloServlet";); URLConnection conn = url.openConnection(); conn.setDoOutput(true); Toast.makeText(getBaseContext(), "connection set", Toast.LENGTH_SHORT).show(); OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream()); writer.write("value=hello&anotherValue=imran"); writer.flush(); Toast.makeText(getBaseContext(), "sent the data", Toast.LENGTH_SHORT).show(); String line; BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); while ((line = reader.readLine()) != null) { System.out.println(line); Toast.makeText(getBaseContext(), "received from server"+line, Toast.LENGTH_SHORT).show(); } writer.close(); reader.close(); } catch (Exception e){ } The server code is protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("text/html;charset=UTF-8"); PrintWriter out = response.getWriter(); try { String value = request.getParameter("value"); String value2 = request.getParameter("anotherValue"); System.out.println("The data recieved is:"+value+" and "+value2); out.println(""); out.println(""); out.println("Servlet LoginServlet"); out.println(""); out.println(""); out.println("The data recieved is:"+value+" and "+value2); out.println(""); out.println(""); } finally { out.close(); } } -- 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 To unsubscribe, reply using "remove me" as the subject.
[android-developers] Re: sending lists from a server to client (android)
thank you for sharing your views guy. would you mind suggesting one serialization method..either xml or jason.. i need to learn how that works and then implement the same. Ah..things are getting so complicated :) :) :) Thank you once again guys... On Apr 8, 3:19 am, patbenatar wrote: > Good tutorial on setting up a RESTful client to receive JSON data from > the > Web:http://senior.ceng.metu.edu.tr/2009/praeda/2009/01/11/a-simple-restfu... > > On Apr 7, 11:47 pm, Frank Weiss wrote: > > > "Sterilization" is not really what I had in mind. LOL > > > Actually, when you parse the XML and create an object graph of lists and > > arrays, that's called "de-serialization". What > > serialization/de-serialization means is to turn a nested data structure into > > a stream of characters and vice-versa. > > > On Wed, Apr 7, 2010 at 11:39 PM, Tommy wrote: > > > I agree. I currently use an asp.net web service to create and XML file > > > full of what I want. Then I parse it and create my Lists or Arrays or > > > whatever from the XML. Although I don't know what your purpose is > > > sterilization might be a better option. > > > > *From:* android-developers@googlegroups.com [mailto: > > > android-develop...@googlegroups.com] *On Behalf Of *Frank Weiss > > > *Sent:* Thursday, April 08, 2010 2:37 AM > > > *To:* android-developers@googlegroups.com > > > *Subject:* Re: [android-developers] [SOLVED]Re: sending lists from a > > > server to client (android) > > > > In most cases, all you really need is a request and a response. The > > > request > > > is basically a list of name-value pairs that become the query parameter > > > part > > > of the request URL. The response, in addition to error codes, is not a > > > list > > > of objects, but a data structure that's been serialized. Popular > > > serialization formats are XML and JSON. If you can can be more specific > > > about the request and response data structures, I think you'll get better > > > answers. As they say, half the solution is asking the right question. When > > > you use the term "object", that means quite a few things, especially in > > > the > > > context of an object-oriented programming language, such as Java. See if > > > you > > > can rephrase the question, either without using "object" or else being > > > specific about what it means in the context of your problem. > > > > On Wed, Apr 7, 2010 at 11:15 PM, raqz wrote: > > > > well.. i got this from my java trainer/friend > > > > since the list is an object, we could use the belo code > > > > OutputStream os = socket.getOuputStream(); > > > ObjectOuputStream out = new ObjectOutputStream(os); > > > out.writeObject(list); > > > out.close(); > > > > InputStream is = socket.getInputStream(); > > > ObjectInputStream in = new ObjectInputStream(is); > > > ArrayList list = (ArrayList)in.readObject(); > > > in.close(); > > > > On Apr 7, 8:57 pm, raqz wrote: > > > > Hi, > > > > > I wish to send a list containing objects from server to client and > > > > vice versa through httpurlconnection. > > > > Elaborating the same, the list contains a set of objects which is > > > > defined both in the server and the client. Its just that the server > > > > queries a database and sends the object to the client which collects > > > > the same and displays it to the user. > > > > > Please let me know if thats possible and if it is, how would I be able > > > > to accomplish that. > > > > > Thanks, > > > > Raqeeb > > > > -- > > > 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 > > cr...@googlegroups.com> > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > > > To unsubscribe, reply using "remove me" as the subject. > > > > -- > > > 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 fro
[android-developers] Re: Trying to start a thread dedicated to sending and receiving data
Hi Frank, Thanks for the suggestion. Are you aware of any tutorial or anything like that which would help me do all what you said. Tommy is also trying to get me a code which uses SOAP request to talk to the server. Thanks, Raqeeb On Apr 8, 2:42 am, Frank Weiss wrote: > I think you're doing it the hard way, but maybe that's on purpose. The easy > way is to use UrlConnection instead of sockets and use AsyncTask instead of > creating threads by hand. AsyncTask uses a thread pool and makes it really > easy to hook up actions and responses with the UI. Trying to get a response > back to the UI from a non-UI thread is a well-known headache for Anfroid > programmers. > > On Wed, Apr 7, 2010 at 10:36 PM, raqz wrote: > > 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 listOfFriends = new ArrayList(); > > > 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 namesArray=new > > ArrayList(); > > > 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, > >
[android-developers] Re: Trying to start a thread dedicated to sending and receiving data
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" 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: android-developers@googlegroups.com > > [mailto:android-develop...@googlegroups.com] 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" 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: android-developers@googlegroups.com > > > [mailto:android-develop...@googlegroups.com] 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" 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: android-developers@googlegroups.com > > > > [mailto:android-develop...@googlegroups.com] 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" 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: android-developers@googlegroups.com > > > > > [mailto:android-develop...@googlegroups.com] 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. &
[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" 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: android-developers@googlegroups.com > > [mailto:android-develop...@googlegroups.com] 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" 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: android-developers@googlegroups.com > > > [mailto:android-develop...@googlegroups.com] 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" 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: android-developers@googlegroups.com > > > > [mailto:android-develop...@googlegroups.com] 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 listOfFriends = new > ArrayList(); > > > > int i=0; > > > private String FName=null; > > > private String LName=null; > > > private String Latitude=null; > > > private String Longitude=null; > > >
[android-developers] [SOLVED]Re: sending lists from a server to client (android)
well.. i got this from my java trainer/friend since the list is an object, we could use the belo code OutputStream os = socket.getOuputStream(); ObjectOuputStream out = new ObjectOutputStream(os); out.writeObject(list); out.close(); InputStream is = socket.getInputStream(); ObjectInputStream in = new ObjectInputStream(is); ArrayList list = (ArrayList)in.readObject(); in.close(); On Apr 7, 8:57 pm, raqz wrote: > Hi, > > I wish to send a list containing objects from server to client and > vice versa through httpurlconnection. > Elaborating the same, the list contains a set of objects which is > defined both in the server and the client. Its just that the server > queries a database and sends the object to the client which collects > the same and displays it to the user. > > Please let me know if thats possible and if it is, how would I be able > to accomplish that. > > Thanks, > Raqeeb -- 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 To unsubscribe, reply using "remove me" as the 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" 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: android-developers@googlegroups.com > > [mailto:android-develop...@googlegroups.com] 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" 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: android-developers@googlegroups.com > > > [mailto:android-develop...@googlegroups.com] 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 listOfFriends = new ArrayList(); > > > 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 namesArray=new > > ArrayList(); > > > 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.printStackTra
[android-developers] Re: Trying to start a thread dedicated to sending and receiving data
I tried placing the breakpoint right at the beginning of the code but the app crashes anyways. Am I supposed to run it in debug mode or something like that? On Apr 8, 1:55 am, "Tommy" 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: android-developers@googlegroups.com > > [mailto:android-develop...@googlegroups.com] 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" 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: android-developers@googlegroups.com > > > [mailto:android-develop...@googlegroups.com] 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 listOfFriends = new ArrayList(); > > > 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 namesArray=new > > ArrayList(); > > > 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
[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" 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: android-developers@googlegroups.com > > [mailto:android-develop...@googlegroups.com] 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 listOfFriends = new ArrayList(); > > 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 namesArray=new > ArrayList(); > > 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[
[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 listOfFriends = new ArrayList(); 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 namesArray=new ArrayList(); 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();
[android-developers] sending lists from a server to client (android)
Hi, I wish to send a list containing objects from server to client and vice versa through httpurlconnection. Elaborating the same, the list contains a set of objects which is defined both in the server and the client. Its just that the server queries a database and sends the object to the client which collects the same and displays it to the user. Please let me know if thats possible and if it is, how would I be able to accomplish that. Thanks, Raqeeb -- 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 To unsubscribe, reply using "remove me" as the subject.
[android-developers] Re: Displaying ArrayList in list
great tutorial On Apr 7, 11:57 am, Kumar Bibek wrote: > Refer to this tutorial > > http://tech-droid.blogspot.com/2009/07/custom-listview-for-android.html > > Thanks and Regards, > Kumar Bibek > > On Apr 7, 8:54 pm, raqz wrote: > > > Hi, > > > I wish to display data in the the arraylist in a listview. The > > arraylist is not a generic list but a object defined by me. I want to > > display only certain data of the object. Something like, an object of > > a student, I want to display the student's name only, the student id > > and the student dob is not required. > > > Please help. > > Thanks > > raqeeb -- 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 To unsubscribe, reply using "remove me" as the subject.
[android-developers] Re: Displaying ArrayList in list
hey thanks kumar...I am getting an array of objects from the webserver. is it possible to convert it into xml and then display it as u have done? please let me know On Apr 7, 11:57 am, Kumar Bibek wrote: > Refer to this tutorial > > http://tech-droid.blogspot.com/2009/07/custom-listview-for-android.html > > Thanks and Regards, > Kumar Bibek > > On Apr 7, 8:54 pm, raqz wrote: > > > Hi, > > > I wish to display data in the the arraylist in a listview. The > > arraylist is not a generic list but a object defined by me. I want to > > display only certain data of the object. Something like, an object of > > a student, I want to display the student's name only, the student id > > and the student dob is not required. > > > Please help. > > Thanks > > raqeeb -- 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 To unsubscribe, reply using "remove me" as the subject.
[android-developers] Displaying ArrayList in list
Hi, I wish to display data in the the arraylist in a listview. The arraylist is not a generic list but a object defined by me. I want to display only certain data of the object. Something like, an object of a student, I want to display the student's name only, the student id and the student dob is not required. Please help. Thanks raqeeb -- 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 To unsubscribe, reply using "remove me" as the subject.
[android-developers] Re: Listadapter issue
hi, thanks for the suggestion..i got it right now On Apr 6, 5:17 pm, Bob Kerns wrote: > ArrayList would be a better choice; Vector has extraneous method > synchronization. > > But either one suffers from the problem that you'll need to store > Integer objects rather than int values, which will cause GC. That > should not be a problem here, I just point it out as a difference from > using an int[] array. You can create your own class that acts like > ArrayList, were that a legal construct -- it's not difficult. > Whenever you grow the array, at least double it in size, or you'll end > up paying an exponential cost in copying the data. > > But again, that's not a problem you need to worry about here. Just use > ArrayList. Using it's add(Integer) method, you won't even > need to maintain your 'i' variable. > > On Apr 6, 9:29 am, Michael Rueger wrote: > > > On 4/6/2010 6:17 PM,raqzwrote: > > > > I am trying to record the position into the array a[]. And everytime > > > somebody clicks some row in the list, the i value needs to be > > > incremented. Anything wrong with that? Please suggest some other > > > alternative if you have anything in mind. > > > You need a growing data structure like Vector for this and then append > > the values. > > > Vector positions = new Vector(); > > positions.add(position); > > > The above code isn't complete, left as an exercise to the reader ;-) > > > You defined a zero size array and trying to access it will crash. > > > Michael > > > > On Apr 6, 12:09 pm, Michael Rueger wrote: > > >> On 4/6/2010 6:03 PM,raqzwrote: > > > >>> Hi, I am trying to record the selection made by the user in the array. > > >>> But when I run the app, it crashes the moment I click something. > > >>> Please let me know what could be done for this. > > > >>> public class ListViewExample extends ListActivity > > >>> { > > >>> public int a[]; > > >>> public int i=0; > > > >> ... > > > >>> a[i++]=position; > > > >> That's probably the culprit. > > >> What are you trying to do here? > > > >> Michael -- 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 To unsubscribe, reply using "remove me" as the subject.
[android-developers] Re: Listadapter issue
I am trying to record the position into the array a[]. And everytime somebody clicks some row in the list, the i value needs to be incremented. Anything wrong with that? Please suggest some other alternative if you have anything in mind. On Apr 6, 12:09 pm, Michael Rueger wrote: > On 4/6/2010 6:03 PM, raqz wrote: > > > Hi, I am trying to record the selection made by the user in the array. > > But when I run the app, it crashes the moment I click something. > > Please let me know what could be done for this. > > > public class ListViewExample extends ListActivity > > { > > public int a[]; > > public int i=0; > > ... > > > a[i++]=position; > > That's probably the culprit. > What are you trying to do here? > > Michael -- 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 To unsubscribe, reply using "remove me" as the subject.
[android-developers] Listadapter issue
Hi, I am trying to record the selection made by the user in the array. But when I run the app, it crashes the moment I click something. Please let me know what could be done for this. public class ListViewExample extends ListActivity { public int a[]; public int i=0; public String[] presidents = { "Dwight D. Eisenhower", "John F. Kennedy", "Lyndon B. Johnson", "Richard Nixon", "Gerald Ford", "Jimmy Carter", "Ronald Reagan", "George H. W. Bush", "Bill Clinton", "George W. Bush", "Barack Obama" }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.listview); setListAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, presidents)); } public void onListItemClick( ListView parent, View v, int position, long id) { Toast.makeText(this, "You have selected " + presidents[position], Toast.LENGTH_SHORT).show(); a[i++]=position; } } -- 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] Lists tutorial
Hi Could someone please give me a good link that teaches how to use list view in android. Basically I have an array with names of people which I wanna display on the screen. The user can click and select multiple names, the selections are to be noted down for further processing. I googled and found a number of tutorials but they were of no great help. Please suggest some tutorial which has worked out for you. Thanks, raqz -- 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 To unsubscribe, reply using "remove me" as the subject.
[android-developers] Re: Emulator spoof device id
hahahha..thanks buddy! On Apr 2, 5:35 pm, Dan Sherman wrote: > device = getDeviceId() > if (device.equals("")) { > // generate a random number > device = "emulator"+randomNumber; > > } > On Fri, Apr 2, 2010 at 5:09 PM, raqz wrote: > > Hi, > > > I just used this getDeviceId() to retrieve the unique id of the phone, > > but in the emulator it gives when I try to display it. I know > > it makes sense to do that but can I spoof a device id for testing > > purposes. I need to setup about 4 -5 android devices in my emulator to > > check the functionality of the app that I have written, and the entire > > app revolves around the unique id of the mobile device. Please let me > > know. I just feel, maybe it should be there in the DDMS but I am not > > able to figure it out. > > > Thanks, > > Raqeeb > > > -- > > 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 > > > To unsubscribe, reply using "remove me" as the subject. -- 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] Emulator spoof device id
Hi, I just used this getDeviceId() to retrieve the unique id of the phone, but in the emulator it gives when I try to display it. I know it makes sense to do that but can I spoof a device id for testing purposes. I need to setup about 4 -5 android devices in my emulator to check the functionality of the app that I have written, and the entire app revolves around the unique id of the mobile device. Please let me know. I just feel, maybe it should be there in the DDMS but I am not able to figure it out. Thanks, Raqeeb -- 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 To unsubscribe, reply using "remove me" as the subject.
[android-developers] Simple Activity Related
I have this main class which displays a button and on click of the button, the NextActivity class should be called. I have defined the NextActivity class in the same package. But when I click the button, the application closes stating there is some error. But when i directly start an intent (un comment the last line). The application goes there without displaying the Main class. Please let me know what is the mistake i am doing. package com.intents; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; public class MainClass extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button btnOpen = (Button) findViewById(R.id.btnNext); btnOpen.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Toast.makeText(getBaseContext(), "You have clicked the Open button", Toast.LENGTH_SHORT).show(); Intent i = new Intent(); i.setClassName("com.intents", "NextActivity"); startActivity(i); } }); //startActivity(new Intent( this, NextActivity.class)); } } -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
[android-developers] Re: Sending GPS location over socket
could you please tell me why it aint possible through sockets? or is there any other way to do that? On Mar 28, 7:41 pm, JP wrote: > Connecting to a web server... Unless something unusual is going on, > that would be rather through HTTP requests, not through bare bones > socket-based communications. > > On Mar 28, 3:36 pm, raqz wrote: > > > Hello, > > > Could you please tell me how do I send the GPS location of the phone > > to a webserver through a socket. I am able to display the gps location > > on the screen with a toast widget in locationchanged() function. > > After that, I try to send the co-ordinates through a socket but the > > emulator crashes. > > Could some one please tell me how to go about this. > > > Thanks, > > Raqeeb -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
[android-developers] Sending GPS location over socket
Hello, Could you please tell me how do I send the GPS location of the phone to a webserver through a socket. I am able to display the gps location on the screen with a toast widget in locationchanged() function. After that, I try to send the co-ordinates through a socket but the emulator crashes. Could some one please tell me how to go about this. Thanks, Raqeeb -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
[android-developers] Re: Use HTTP post method or Simple Java Socket Program
I am not sure if I asked that, I clicked on the link you gave but it aint opening, conversation not able to loaded. Could you please paste the solution. Thanks, raqz On Mar 20, 9:47 pm, David Ashwood wrote: > Didn't you already ask this > raqz?https://mail.google.com/mail/?tab=cm#inbox/1277ab8600744cb5 > > On 21 March 2010 02:44, raqz wrote: > > > Hi, > > > Could someone please suggest me a good/efficient way to communicate > > with > > the server. > > I could think of two options > > 1) Use http post methods to send data to a php script at the server > > which would later call the google api's written in another java > > program (jar)\or use php to use google api's (if its possible) to find > > nearby restaurants and send the list back to client. > > 2) Use simple java socket programming. The server has a jar file that > > supports multi threading and it does the job of finding restaurants > > and sending the list. > > > Thanks, > > Raqeeb > > > -- > > 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 > > > To unsubscribe from this group, send email to android-developers+ > > unsubscribegooglegroups.com or reply to this email with the words "REMOVE > > ME" as the subject. -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
[android-developers] Re: Sending/Saving/Retrieving gps location
I could write the location on to a file. Now I tried sending the location information through a socket but the app crashed. Could you please tell me if that's possible. Thanks, Raqeeb On Mar 21, 6:05 am, raqz wrote: > Hi, > > I have setup the code for fetching the gps location of the device when > the device's location changes. But I want to save this location on a > file or send this location information to my webserver. > I tried creating a class with setter and getter methods but its not > storing the info. When I run the app, it closes with unxpected error. > > Could some one please tell me how to go about this. > > Thanks, > raqz > > Note: I have declared myLocation as public in the main function. > [CODE] > public class MyLocation{ > private double latitude; > private double longitude; > private long time; > > public MyLocation(double latitude, double longitude, long > time) { > this.latitude = latitude; > this.longitude = longitude; > this.time = time; > } > > public double giveMyLatitude(){ > return (latitude); > } > public double giveMyLongitude(){ > return (longitude); > } > public double giveMyTime(){ > return (time); > } > [/CODE] > > [CODE] > public void onLocationChanged(Location arg0) { > Toast.LENGTH_SHORT).show(); > myLocation = new > MyLocation(arg0.getLatitude(),arg0.getLongitude(),arg0.getTime()); > GeoPoint p = new GeoPoint((int) > (arg0.getLatitude()*1E6),(int) > (arg0.getLongitude()*1E6)); > mc.animateTo(p); > mc.setZoom(16); > mapView.invalidate(); > [/CODE] -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
[android-developers] Sending/Saving/Retrieving gps location
Hi, I have setup the code for fetching the gps location of the device when the device's location changes. But I want to save this location on a file or send this location information to my webserver. I tried creating a class with setter and getter methods but its not storing the info. When I run the app, it closes with unxpected error. Could some one please tell me how to go about this. Thanks, raqz Note: I have declared myLocation as public in the main function. [CODE] public class MyLocation{ private double latitude; private double longitude; private long time; public MyLocation(double latitude, double longitude, long time) { this.latitude = latitude; this.longitude = longitude; this.time = time; } public double giveMyLatitude(){ return (latitude); } public double giveMyLongitude(){ return (longitude); } public double giveMyTime(){ return (time); } [/CODE] [CODE] public void onLocationChanged(Location arg0) { Toast.LENGTH_SHORT).show(); myLocation = new MyLocation(arg0.getLatitude(),arg0.getLongitude(),arg0.getTime()); GeoPoint p = new GeoPoint((int) (arg0.getLatitude()*1E6),(int) (arg0.getLongitude()*1E6)); mc.animateTo(p); mc.setZoom(16); mapView.invalidate(); [/CODE] -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
[android-developers] Re: SOLVED - Eclipse problem with "Project contains errors" and nothing is obviously wrong
Hi...even I have seen this error so I keep on deleting the code and readding the same :) it works! On Mar 21, 12:02 am, Stephen Lebed wrote: > I haven't seen this mentioned anywhere so I'm posting it here if other > people come across this issue. > > Somethings I'll have an ?.xml file selected when I compile a project, > only to have a ?.out.xml generated. Deleting the file doesn't clear > the error, and Eclipse won't compile the project. It just reports > that your project contains errors. > > The solution is to go to Project/Clean. This will clear the error in > the project and allow it to compile. > > I hope this is helpful to someone. It may have been obvious, but not > to me. > > Best, > Stephen Lebed -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
[android-developers] Use HTTP post method or Simple Java Socket Program
Hi, Could someone please suggest me a good/efficient way to communicate with the server. I could think of two options 1) Use http post methods to send data to a php script at the server which would later call the google api's written in another java program (jar)\or use php to use google api's (if its possible) to find nearby restaurants and send the list back to client. 2) Use simple java socket programming. The server has a jar file that supports multi threading and it does the job of finding restaurants and sending the list. Thanks, Raqeeb -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
[android-developers] Re: Use Mobile Device CPU or Server CPU
hey thanks Yahel... Could you please suggest me a good/efficient way to communicate with the server. I could think of two options 1) Use http post methods to send data to a php script at the server which would later call the google api's written in another java program (jar)\or use php to use google api's (if its possible) to find nearby restaurants and send the list back to client. 2) Use simple java socket programming. The server has a jar file that supports multi threading and it does the job of finding restaurants and sending the list. What do you have to say about it. Thanks, Raqeeb On Mar 20, 4:56 am, Yahel wrote: > Hi raqz, > > It sounds like the perfect job for a web service. The gps coordinate > are sent to the server which computes the complete list of restaurant > nearby. > > Pros : > - You can make your app available on any platform(iphone, facebook > app) without a need to change the server side code. > - You don't use any resources on the phone either CPU or memory(no > databases), good for users. > - No need for synching overhead and no chance of out of synch data > > Cons : > - Can't work when the mobile is offline > - You are not using the resources of the individual phones. If your > app is successful, the load on your server could get quite high > > Obviously, the first con, isn't really a con, that would be a very > good problem to have if you know you are going to monetize your app :D > > Maybe you can use some caching techniques to relieve some of the load > on the server. > For example if someone sends gps coordinate in San Francisco, download > a zip file of all the restaurants there. > And then use that local database for a few days or so before > resynching. > That removes one of the pros in my list, but since it also remove the > first con, that doesn't count :D > > Yahel -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
[android-developers] Use Mobile Device CPU or Server CPU
Hi, I am planning to design and write an application which displays all possible restaurants/malls etc around the mobile device. For this, do I send the GPS info to the server and let server do the processing and return the list of all possible restaurants/malls or let the mobile device itself process, find and list that. Please advise. I don't want the mobile device to get any slower. Thanks, Raqeeb -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
[android-developers] Unable to set the maps program working
Hello, I tried a lot, read most of the tutorials on the web but still unable to run the program. The moment i run, it its says, the process stopped and closes. Please let me knwo what is wrong...the code is as below main.xml http://schemas.android.com/apk/res/ android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > manifest.xml http://schemas.android.com/apk/res/android"; package="com.gmaps" android:versionCode="1" android:versionName="1.0"> GMaps.java package com.gmaps; import com.google.android.maps.MapActivity; import android.app.Activity; import android.os.Bundle; import android.widget.Toast; public class GMaps extends MapActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Toast.makeText(getBaseContext(),1, Toast.LENGTH_SHORT).show(); } @Override protected boolean isRouteDisplayed() { // TODO Auto-generated method stub return false; } } The environment path variable has both jdk and android sdk path same with the classpath. I dont know where I am going wrong. Could some one please correct me. -- 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 To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
[android-developers] Re: google map api are missing
i checked the download manager but i dont find the google api package there as well... i downloaded the entire sdk again to check but its not present in the addon either...nor am i able to get it from the manager On Mar 12, 5:09 pm, Mark Murphy wrote: > raqz wrote: > > sorry..but i dont find an google api listed there buddy...i dont find > > a link to download that as well...can you please help me > > http://developer.android.com/sdk/adding-components.html > > -- > Mark Murphy (a Commons > Guy)http://commonsware.com|http://twitter.com/commonsguy > > Warescription: Three Android Books, Plus Updates, One Low Price! -- 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: google map api are missing
sorry..but i dont find an google api listed there buddy...i dont find a link to download that as well...can you please help me On Mar 12, 4:56 pm, TreKing wrote: > On Fri, Mar 12, 2010 at 3:38 PM, raqz wrote: > > hi..i wanted to use the MapActivity but i dont find the google api add > > on... > > In Eclipse, Project -> Properties -> Android -> Select on of the Google APIs > matching the platform version you want to target (generally the latest one). > > - > TreKing - Chicago transit tracking app for Android-powered > deviceshttp://sites.google.com/site/rezmobileapps/treking -- 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] google map api are missing
hi..i wanted to use the MapActivity but i dont find the google api add on...its not available for download as well... i checked the /addon folder..but its empty...could some one please tell me how to download them -- 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: su access
I have set the permissions right...but still unable to use that... i am useing sdk 2.0 please help me with this simple example On Mar 12, 10:21 am, Rogério de Souza Moraes wrote: > Hi, > > what version of the SDK are you testing? I had this problem when I was > testing with SDK 1.6, but when I moved to SDK 2.0 it started working. > > Regards, > > Rogerio > > 2010/3/12 raqz > > > Hello... > > I am a novice in android programming and wanted to work on the GPS > > related apps. I tried using DDMS in eclipse but it doesn't send the co- > > ordinates (or my app doesn't pick it up). I tried typing 'geo' with > > the co-ordinates but it gives a message as permission denied. Could > > some one please tell me how do I go about sending GPS co-ordinates and > > also use the emulator...become SU... > > > 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 -- 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] su access
Hello... I am a novice in android programming and wanted to work on the GPS related apps. I tried using DDMS in eclipse but it doesn't send the co- ordinates (or my app doesn't pick it up). I tried typing 'geo' with the co-ordinates but it gives a message as permission denied. Could some one please tell me how do I go about sending GPS co-ordinates and also use the emulator...become SU... 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
[android-developers] Re: Tips to write an app that fetches data from website and displays it on screen
Hi, Hmm...So I need to start reading about the HTTP classes android provides to find out how it parses data. Is that what you want to convey Mohamed? Regards, Raqeeb On Mar 2, 9:50 am, alfadel mohamed wrote: > hi there > > i am not sure about your project requirement , but first of all you need to > know how to communicate with the website server that you want to retrieve > data from using http classes and then parse the data to extract .. > > rgdsOn Tue, Mar 2, 2010 at 4:50 AM, raqz wrote: > > Hi, > > > I am new to android programming and have a strong keen interest to > > learn it. I want to write a program that fetches the data from a > > website, segregates it and displays it on the screen of the phone. The > > data could be grocery list from a supermarket or sale items in a > > mall. > > Could you please suggest as to how I can go ahead and start this. > > > Thanks, > > Raqeeb > > > -- > > 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 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] Tips to write an app that fetches data from website and displays it on screen
Hi, I am new to android programming and have a strong keen interest to learn it. I want to write a program that fetches the data from a website, segregates it and displays it on the screen of the phone. The data could be grocery list from a supermarket or sale items in a mall. Could you please suggest as to how I can go ahead and start this. Thanks, Raqeeb -- 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