[android-developers] Help me with JSON Objects
Hi everyone, I facing a issue reading back the data i posted on the server... can anyone tell me what went wrong? Here is the code snippet :: private void postData1(){ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost( http://www.aneeshpradeep.co.uk/NottTest/post.php;); JSONObject json = new JSONObject(); try { // JSON data: try { json.put(name, Fahmi Rahman); } catch (JSONException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } json.put(position, sysdev); JSONArray postjson = new JSONArray(); postjson.put(json); // Post the data: httppost.setHeader(json, json.toString()); httppost.getParams().setParameter(jsonpost, postjson); // Execute HTTP Post Request System.out.print(json); HttpResponse response = httpclient.execute(httppost); tv.setText(Hiii); // for JSON: if (response != null) { Log.i(Json,respose); System.out.print(loool); InputStream is = response.getEntity().getContent(); BufferedReader reader = new BufferedReader( new InputStreamReader(is)); StringBuilder sb = new StringBuilder(); String line = null; try { while ((line = reader.readLine()) != null) { sb.append(line + \n); } } catch (IOException e) { e.printStackTrace(); } finally { try { is.close(); } catch (IOException e) { e.printStackTrace(); } } text = sb.toString(); } else{ tv.setText(no respose); Log.i(Noting,happended); } //tv.setText(text); } catch (ClientProtocolException e) { Log.i(Error,Prtocol); } catch (IOException e) { Log.i(Error,IO); } catch (JSONException e) { Log.i(Error,JOSON); } } On Tue, Jun 19, 2012 at 7:09 PM, aishwarya shukla aishwaryashukl...@gmail.com wrote: -- Forwarded message -- From: aishwarya shukla aishwaryashukl...@gmail.com Date: Mon, Jun 18, 2012 at 10:49 AM Subject: My experience of the first ever company outbound To: Lakshmi Seetharam lakshmi...@gmail.com, sneha sneha...@gmail.com, Sanjana Suresh sanjan...@gmail.com, Kapsa Bagrecha kapilbagre...@gmail.com, sneha lakshmish xl sneha.lakshmis...@gmail.com Summary: 60 kms of trek in 5 days, climb from 4200ft to 13200 ft and back, from 44 degree Celsius to ice and back. 5 days of training at the base camp before the actual trek.. Stay in jungle, fetch vegetables and firewood in jungle and make your own food, no civilisation or mobile connectivity for 5 days. No basic amenities and completely living out in the wild in a group of 8 unknown people. Lots of risk, glad to be alive and still can't believe it that I made it back without any major injury. Hi all, As I write this while on the 8 hour road trip from dehradun to Delhi, the last 15 days are probably a life changing experience. So let me start a narrative on it this Way.. I joined Tata Motors as a Post Graduate Trainee (PGT) a month ago (14 may). The PGT cadre of Tata is a very well treated group of young and best managers and future leaders from top-10 b-schools in the country. We are treated really well and that includes almost a year of stay in a 3 star hotel next to gateway of India. Tata believes that we being the future leaders ought to be given a outbound worthy enough to signify the end of our MBA course and our welcome to the company. And so after a 3 week long induction in South Bombay, we are sent in batches to Uttarakashi in Uttaranchal for the outbound. So let me now start from the first day.. we (11 tata motors ppl) almost miss the flight to Delhi (cause I was late while packing) ... then we goto Dehradun in a cab and the next day we proceed to Rwada village in Uttarkashi which is our base camp (about 100 kms from Gangotri). The base camp is next to a tributary of Ganges (Asi-Ganga from Dodital) which is our source of water for every need. Next up we are issued our rucksack and sleeping bag and told about basic do's and don'ts before we are sleep in our tents. The next morning begins at 5:30 AM with basic PT (a 3 kms walk and few exercises) and then we (48 people from different Tata companies) are divided
[android-developers] Looking for Unlocked CDMA Android Phones or any high-end Android CDMA phone that works in India (Band 800 Mhz) eom
-- 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] someone please help me with these issues.
1. I am using a Broadcast Receiver which acquires a static WakeLock, then immediately starts an activity which starts a media player instance inside its onCreate, at the last line of OnCreate i have released the static wakelock which i had acquired in the BroadCastReceiver. Everything seems to work fine, except for the fact that the screen does wakeup but is locked and has to be manually unlocked before the user can see my activity, though the media player starts playing normally before itself. I have set lockStatic=mgr.newWakeLock(PowerManager.FULL_WAKE_LOCK| PowerManager.ACQUIRE_CAUSES_WAKEUP, LOCK_NAME_STATIC); still the screen has to be manually unlocked before the user can see the activity. Any workaround? 2. I have used an EditText inside a tablelayout, tablerow and have set the android:height and width to wrap_content, but still when i type on the softkeypad it exceeds the bounds of the EditText Box and overflows the screen too. have tried various properties on the EditText but none of them seems to work. 3. I have an Activity a ListView Activity which populates the List from a db. When the user clicks on an item in a list, i take him to a new Activity from where he can also delete the item he selected. The problem is that the Parent Activity's ListView is not refreshed and continues showing redundant content, when i have finished the child activity. I have tried making the cursor as static and calling cursor.requery() from my child activity before i finish it, but it doesnt seem to fix the issue. 4. I have used an Activity say activityA which sets up alarm using AlarmManager.set to a Receiver say RecA. If i want to cancel this alarm later from an Activity say ActivityB how do i do so? Somone please respond to the above issues soon. I have been trying a few workaounds since past few days, but am not able to fix these issues. Thanks in advance. :) -- 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] How to speed up the browser of the Android Emulator for 2.1
Hello, The internet browser works very slowly inside the emulator for Android 2.1 AVD. I tried using -netfast switch also while launching the emulator, but it doesnt help much. The same websites when i open in my Browser from my desktop , it opens very fast, and the same website inside emulator opens very slowly. Also i get only 2 towers on the network strength indicator in my emulator. Is there any way to improve the network signal inside the emulator? I have also noticed that emulator would get the network only if i am connected to the internet, else it gives no signal I am trying to simulate a very simple sms message sending and receving between two instances of emulators opened on 2 AVD. The message sending is successful only if my internet connection is on before i launch the emulator, else it gives no Service and message is not sent. I have noticed that a DNS SERVER NOT FOUND warning comes if i try to launch the emulator with my internet connection switched off. Is there any way out to solve this? Regards, Aishwarya -- 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] How to start another application from my activity.
I want to know if there is any way to start another application from within my application. Specifically i am trying to a have a shortcut (button) to Google Maps Application within my application. Also is there any way to start another process from within my android appplication? Regards, Aishwarya -- 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] Help me in TextMessage and DataMessage
Hello Everyone I am unable to use the sendTextMessage Function of the smsManager class successfully. The other emulator is not reporting the message received. No notification comes on it. However i am able to send the Text Messages normally using the built in Messaging App in the Application. Also i downloaded and tried the SMS tutorials in the mobiforge and other websites, the tutorial program is crashing. // Code is as given below package sms.app; import android.app.Activity; import android.telephony.*; import android.os.Bundle; import android.widget.Toast; import android.content.Intent; import android.app.PendingIntent; import android.content.Context; public class smsapplication extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); SmsManager s=SmsManager.getDefault(); Intent intent=new Intent(); int requestCode=0; int flags=0; PendingIntent si=PendingIntent.getActivity(getApplicationContext(), requestCode, intent, flags); try{ s.sendTextMessage(5554, null, This is my string, si, null); } catch(IllegalArgumentException e) { Toast.makeText(getBaseContext(), Exception caught, Toast.LENGTH_SHORT).show(); } finally { Toast.makeText(getBaseContext(), Exception not caught, Toast.LENGTH_SHORT).show(); } final int genfailure=s.RESULT_ERROR_GENERIC_FAILURE; if (genfailure==1) Toast.makeText(getBaseContext(), GENREIC_FAILURE, Toast.LENGTH_SHORT).show(); final int noservice=s.RESULT_ERROR_NO_SERVICE; if (noservice==4) Toast.makeText(getBaseContext(), NO SERVICE, Toast.LENGTH_SHORT).show(); final int nullpdu=s.RESULT_ERROR_NULL_PDU; if (nullpdu==3) Toast.makeText(getBaseContext(), NULL PDU, Toast.LENGTH_SHORT).show(); final int radiooff=s.RESULT_ERROR_RADIO_OFF; if (radiooff==2) Toast.makeText(getBaseContext(), RADIO OFF, Toast.LENGTH_SHORT).show(); final int iccunsent=s.STATUS_ON_ICC_UNSENT; if (iccunsent==7) Toast.makeText(getBaseContext(), ICC unsent, Toast.LENGTH_SHORT).show(); final int iccsent=s.STATUS_ON_ICC_SENT; if (iccsent==7) Toast.makeText(getBaseContext(), ICC sent, Toast.LENGTH_SHORT).show(); } } Also i have given the SMS_SEND permission in the manifest file. I tried the same code in different machine too, it doesnt work. Also most of the tutorials in the net use the deprecated function android.telephony.gsm.SmsManager and not the new one android.telephony.SmsManager. For my project work i have to use a datasms . Can anyone help me with a working sample app in Android 2.0 or 2.1 which uses data message. Further how i am not able to figure out how to register my recipent application to a particular port to which i am sending a data message using another instance of the emulator. I need to solve this issue fast. I am stuck at this place for my project, Any Help would be highly appreciated. -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] VerifyError - how can I solve this error?
Hello Everyone I am unable to use the sendTextMessage Function of the smsManager class successfully. The other emulator is not reporting the message received. No notification comes on it. However i am able to send the Text Messages normally using the built in Messaging App in the Application. Also i downloaded and tried the SMS tutorials in the mobiforge and other websites, the tutorial program is crashing. // Code is as given below package sms.app; import android.app.Activity; import android.telephony.*; import android.os.Bundle; import android.widget.Toast; import android.content.Intent; import android.app.PendingIntent; import android.content.Context; public class smsapplication extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); SmsManager s=SmsManager.getDefault(); Intent intent=new Intent(); int requestCode=0; int flags=0; PendingIntent si=PendingIntent.getActivity(getApplicationContext(), requestCode, intent, flags); try{ s.sendTextMessage(5554, null, This is my string, si, null); } catch(IllegalArgumentException e) { Toast.makeText(getBaseContext(), Exception caught, Toast.LENGTH_SHORT).show(); } finally { Toast.makeText(getBaseContext(), Exception not caught, Toast.LENGTH_SHORT).show(); } final int genfailure=s.RESULT_ERROR_GENERIC_FAILURE; if (genfailure==1) Toast.makeText(getBaseContext(), GENREIC_FAILURE, Toast.LENGTH_SHORT).show(); final int noservice=s.RESULT_ERROR_NO_SERVICE; if (noservice==4) Toast.makeText(getBaseContext(), NO SERVICE, Toast.LENGTH_SHORT).show(); final int nullpdu=s.RESULT_ERROR_NULL_PDU; if (nullpdu==3) Toast.makeText(getBaseContext(), NULL PDU, Toast.LENGTH_SHORT).show(); final int radiooff=s.RESULT_ERROR_RADIO_OFF; if (radiooff==2) Toast.makeText(getBaseContext(), RADIO OFF, Toast.LENGTH_SHORT).show(); final int iccunsent=s.STATUS_ON_ICC_UNSENT; if (iccunsent==7) Toast.makeText(getBaseContext(), ICC unsent, Toast.LENGTH_SHORT).show(); final int iccsent=s.STATUS_ON_ICC_SENT; if (iccsent==7) Toast.makeText(getBaseContext(), ICC sent, Toast.LENGTH_SHORT).show(); } } Also i have given the SMS_SEND permission in the manifest file. I tried the same code in different machine too, it doesnt work. Also most of the tutorials in the net use the deprecated function android.telephony.gsm.SmsManager and not the new one android.telephony.SmsManager. For my project work i have to use a datasms . Can anyone help me with a working sample app in Android 2.0 or 2.1 which uses data message. Further how i am not able to figure out how to register my recipent application to a particular port to which i am sending a data message using another instance of the emulator. I need to solve this issue fast. I am stuck at this place for my project, Any Help would be highly appreciated. -- 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