IDE: Android Studio
Framework: 2.2+
Notes:
I've kept trying to apply the articles I have read online about Android Studio and HTTP Web Requests. I haven't had success yet.
It is just that the depreciated methods are always growing as new content is released, therefore it makes it more challenging to just google it.
Objective:
Could someone write up a sample of an HTTP Post Request to http://www.lipsum.com/feed/html and feed the the requests source to the verbose log?
Restrictions:
I cannot give you the actual objective which I am trying to accomplish, as this is for a college final. Therefore, I can only asked to be pointed the right direction by being previewed to functional examples and online content.
What I Have So Far:
package net.kbhtech.lorumipsum;
import android.support.annotation.NonNull;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
public class HttpRequests {
private String URL;
private Map<String, String> Properties;
private String Source;
private Method method;
public enum Method{
GET, POST
}
public HttpRequests(String URL){
InitializeComponents();
}
public HttpRequests(String url, Map<String, String> properties, Method method){
InitializeComponents();
this.Properties = Properties;
this.URL = url;
this.method = method;
this.Properties = properties;
}
private void request(){
if(method == method.GET){
this.get();
}else if(method == method.POST) {
this.post();
}else{
throw new NoSuchMethodError();
}
}
private void get(){
}
private void post(){
}
public Map<String, String> getProperties(){
return this.Properties;
}
public String getURL(){
return this.URL;
}
public String getSource(){
return Source;
}
public Method getMethod(){
return this.method;
}
private void InitializeComponents(){
Properties = new HashMap<String, String>();
URL = "";
}
}
Thanks;
Kevin B. Harris
What I have tried:
http://www.wikihow.com/Execute-HTTP-POST-Requests-in-Android
http://androidexample.com/How_To_Make_HTTP_POST_Request_To_Server_-_Android_Example/index.php?view=article_discription&aid=64&aaid=89