Android OS Forum banner
1 - 1 of 1 Posts

·
KeyKitLimeKat
Joined
·
545 Posts
Discussion Starter · #1 ·
Hey guys, I have an app I'm working on where it will prompt the user for a Name and Email..

When the user hits submit it will then try to collect the data and send it to a PHP script that will then return a JSON array..

I have had this work for so long on Gingerbread Phones (HTC Thunderbolt, Motorola Droid (Milestone), DroidX, Samsung Moment)

However, when I try to use my Motorola Xoom (HoneyComb) for some reason it is getting hung up at HttpResponse..

Code:
<br />
try<br />
{<br />
	HttpClient httpclient = new DefaultHttpClient();<br />
	HttpPost httppost = new HttpPost("http://link.to.my.php.script/");<br />
	httppost.setEntity(new UrlEncodedFormEntity(infoValuePairs));<br />
	[b]HttpResponse response = httpclient.execute(httppost);[/b] //**Jumps to the catch here!**<br />
	HttpEntity entity = response.getEntity();<br />
	InputStream is = entity.getContent();<br />
<br />
	BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8);<br />
	StringBuilder sb = new StringBuilder();<br />
	String line = null;<br />
	while ((line = reader.readLine()) != null)<br />
	{<br />
		sb.append(line);<br />
	}<br />
	is.close();<br />
<br />
	String result = sb.toString();<br />
<br />
	JSONArray jArray = new JSONArray(result);<br />
	JSONObject json_data = jArray.getJSONObject(0);<br />
<br />
	sqlName  = json_data.getString("name");<br />
	sqlEmail = json_data.getString("email");<br />
}<br />
catch(Exception e)<br />
{<br />
	setExceptionVerify(e.toString());<br />
}<br />
In the code you can see where I commented where it will jump.. I thought it might have something to do with it being a Wifi-Only Device, but I wasn't sure if there was a special permission for that.. Maybe because android.permissions.INTERNET is only for like 3G/4G etc..

Anyway, here is what I have for permissions in my Manifest file:

Code:
<br />
   <uses-permission android:name="android.permission.INTERNET"/><br />
   <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/><br />
Any help is greatly appreciated guys!

Thanks in advance
 
1 - 1 of 1 Posts
Top