With the old Apache stuff deprecated in API 22, I am finally getting around to updating my network stuff.
Using openConnection()
seems pretty straight forward. However, I have not seen any good example to send parameters with it.
How would I update this code?
ArrayList<NameValuePair> param = new ArrayList<NameValuePair>();
param.add(new BasicNameValuePair("user_id",String.valueOf(userId)));
httpPost.setEntity(new UrlEncodedFormEntity(param));
Now that NameValuePair
and BasicNameValuePair
are also deprecated.
EDIT: My server side php
code doesn't expect JSON parameters and I can't all of the sudden switch due to existing users -- so a non-JSON answer is recommended.
EDIT2: I just need to Target Android 4.1+ at the moment.
@SuppressLint
or ` @TargetApi(22)` to use newer library, and use@suppresswarnings
to clear that warnints. I think that would't be bad decision. – Lamkin