Oauth2 doesnt open an browser and a token in an android app - java

Trying to use the Oauth authorization flow in an andoid app using java. No browser opened needed for authorizing. I don't know if i should ask here or on the api's website
permission for internet is granted in manifest.xml
MainActivity.java:
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button RankConfirm = findViewById(R.id.UsernameConfirm);
RankConfirm.setOnClickListener(v -> {
final EditText username_box = findViewById(R.id.OsuUsername);
final String Username = username_box.getText().toString();
final TextView RankView = findViewById(R.id.RankView);
API_Response.UpdateRank(Username,RankView);
});}
}
API.java
import android.util.Log;
import android.widget.TextView;
import java.io.IOException;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
public class API {
public static void UpdateRank(String Username, TextView RankView) {
Thread NetworkThread = new Thread ("NetworkThread"){
private volatile String Rank = "nic";
public void run() {
OkHttpClient client1 = new OkHttpClient();
Request request1 = new Request.Builder()
.url("https://osu.ppy.sh/oauth/authorize/?client_id=14403&redirect_uri=https://google.com&response_type=code&scope=public")
.build();
try {
Response response1 = client1.newCall(request1).execute();
String Code = response1.body().string();
Log.e("Debug", Code);
} catch (IOException e) {
Log.e("Debug", "IO exception1");
}```

Realized i was doing it completly wrong and i should have used a WebView

Related

How to unzip password protected zip files in android studio?

I tried unzipping a zip file with password But it goes to a dead end. Like It says No read permission. I requested the permission from the code and allowed in app. Still error coming
Error - net.lingala.zip4j.exception.ZipException: no read access for the input zip file
This is the code
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentManager;
import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import net.lingala.zip4j.exception.ZipException;
import net.lingala.zip4j.ZipFile;
public class MainActivity2 extends AppCompatActivity {
;
private FileChooserFragment fragment;
private Button buttonShowInfo;
Context context;
String vv;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.buttonShowInfo = this.findViewById(R.id.button_showInfo);
this.buttonShowInfo.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
try {
showInfo();
} catch (ZipException e) {
e.printStackTrace();
}
}
});
}
private void showInfo() throws ZipException {
try {
//
System.out.println(Environment.getExternalStorageDirectory().toString());
ZipFile zipFile = new ZipFile("/storage/emulated/0/Download/1.zip);
if (zipFile.isEncrypted()) {
zipFile.setPassword("aa".toCharArray());
}
zipFile.extractAll(Environment.getExternalStorageDirectory().toString());
break;
} catch (ZipException e) {
System.out.println("nope");
e.printStackTrace();
}
}}
Password is aa
Please give me a code which works in new version of android studio and android 11 atleast

why okhttp3 client.execute does not work?

I have a simple flask app that takes an image and return prediction from keras model
flask code
#app.route('/route', methods=['GET','POST'])
def rose():
model = load_model('model.h5')
model.compile(loss='categorical_crossentropy',
optimizer='rmsprop',
metrics=['accuracy'])
img_width, img_height = 128, 128
img = Image.open(request.files['file'])
if img.mode != "RGB":
img.convert("RGB")
img = img.resize((img_width, img_height))
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
images = np.vstack([x])
classes = model.predict(images)
return str(classes )
I need to upload the image from an android application using camerakit-android: here is my code:
package com.bostanji.wardeh.ui.home;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.media.Image;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.provider.MediaStore;
import android.provider.Settings;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import com.bostanji.wardeh.R;
import com.wonderkiln.camerakit.CameraKitError;
import com.wonderkiln.camerakit.CameraKitEvent;
import com.wonderkiln.camerakit.CameraKitEventListener;
import com.wonderkiln.camerakit.CameraKitImage;
import com.wonderkiln.camerakit.CameraKitVideo;
import com.wonderkiln.camerakit.CameraView;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.net.Socket;
import java.util.List;
import java.util.concurrent.TimeUnit;
import dmax.dialog.SpotsDialog;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class HomeFragment extends Fragment {
private CameraView cameraView;
private Button button;
private AlertDialog waitingDialog;
private Dialog emptyDialog;
#Override
public void onResume() {
super.onResume();
cameraView.start();
}
#Override
public void onPause() {
super.onPause();
cameraView.stop();
}
public View onCreateView(#NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
View root = inflater.inflate(R.layout.fragment_home, container, false);
cameraView = root.findViewById(R.id.camera);
button = root.findViewById(R.id.btn_detect);
waitingDialog = new SpotsDialog.Builder().setContext(getContext()).setMessage("Please wait").setCancelable(false).build();
cameraView.addCameraKitListener(new CameraKitEventListener() {
#Override
public void onEvent(CameraKitEvent cameraKitEvent) {
}
#Override
public void onError(CameraKitError cameraKitError) {
}
#Override
public void onImage(final CameraKitImage cameraKitImage) {
//waitingDialog.show();
Bitmap bitmap = cameraKitImage.getBitmap();
final byte[] img = cameraKitImage.getJpeg();
final Bitmap uploadMap = bitmap;
bitmap = Bitmap.createScaledBitmap(bitmap, cameraView.getWidth(), cameraView.getHeight(), false);
cameraView.stop();
waitingDialog.show();
final Handler handler = new Handler();
new Thread(){
#Override
public void run() {
try {
OkHttpClient client = new OkHttpClient();
String postUrl= "flaskapp.com/route";
final MediaType MEDIA_TYPE_JPEG = MediaType.parse("image/jpeg");
RequestBody req = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("file","rose.jpeg", RequestBody.create(img, MEDIA_TYPE_JPEG)).build();
Request request = new Request.Builder()
.url(postUrl)
.post(req)
.build();
try {
Response response = client.newCall(request).execute();
final String r = response.body().string();
handler.post(new Runnable() {
#Override
public void run() {
waitingDialog.dismiss();
Toast.makeText(getContext(), r, Toast.LENGTH_LONG).show();
}
});
} catch (IOException e) {
e.printStackTrace();
}
} catch (Exception e) {
}
}
}.start();
}
#Override
public void onVideo(CameraKitVideo cameraKitVideo) {
}
});
button.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
cameraView.start();
cameraView.captureImage();
}
});
return root;
}
}
once I click the button to take a picture and upload it the waiting dialog show and stays like this for ever.
P.S I don't need to send in the post request anything else other than the image and wait for the response
You use a deprecated constructor, which is error prone. It would be better to use final Handler handler = new Handler(Looper.getMainLooper());
Furthermore you just post your message when the post request was successful. If it's not successful, the waiting dialog will stay forever.
So it would update your code:
#Override
public void onImage(final CameraKitImage cameraKitImage) {
//waitingDialog.show();
Bitmap bitmap = cameraKitImage.getBitmap();
final byte[] img = cameraKitImage.getJpeg();
final Bitmap uploadMap = bitmap;
bitmap = Bitmap.createScaledBitmap(bitmap, cameraView.getWidth(), cameraView.getHeight(), false);
cameraView.stop();
waitingDialog.show();
final Handler handler = new Handler(Looper.getMainLooper());
new Thread(){
#Override
public void run() {
try {
OkHttpClient client = new OkHttpClient();
String postUrl= "flaskapp.com/route";
final MediaType MEDIA_TYPE_JPEG = MediaType.parse("image/jpeg");
RequestBody req = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("file","rose.jpeg", RequestBody.create(img, MEDIA_TYPE_JPEG)).build();
Request request = new Request.Builder()
.url(postUrl)
.post(req)
.build();
Response response = client.newCall(request).execute();
final String r = response.body().string();
} catch (Exception e) {
Log.e('Camera', 'POST failed', e);
} finally {
handler.post(new Runnable() {
#Override
public void run() {
waitingDialog.dismiss();
Toast.makeText(getContext(), r, Toast.LENGTH_LONG).show();
}
});
}
}.start();
}

Catch a Json string (made using dot net , newtonsoft) in android using Volley.

I need to catch a json string (in my case: ["Java","C","C++"]) in android app using Volley and put it inside a String array courseList.
A few closing brackets may be missing, sorry for that, there is more code in my file, but i could not copy it whole.Please provide code if u can, it will b really helpful. Thanks)
Here is my attempted code:
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.util.Log;
import android.view.View;
import android.support.design.widget.NavigationView;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.JsonRequest;
import com.android.volley.toolbox.Volley;
import org.json.JSONException;
import org.json.JSONObject;
public class MainActivity extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
#Override
protected void onCreate(Bundle savedInstanceState) {
ListView simpleList;
final String[] courseList = new String[3];// = {"HR","C Programming", "C++","C#", "Java", "Javascript", "Angular JS", "Data Structure", "Ajax", "Asp.Net", "jQuery", "json", "SQL"};
int flags[] = {R.drawable.hr,R.drawable.cprogramming, R.drawable.cplus, R.drawable.csharp, R.drawable.java, R.drawable.javascript, R.drawable.angularjs, R.drawable.datastructures, R.drawable.ajax, R.drawable.aspnet, R.drawable.jquery, R.drawable.json, R.drawable.sql};
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// for volley
String jsonURL = "http://192.168.0.131:10462/WebService1.asmx";
final String data = "";
RequestQueue requestQueue;
requestQueue = Volley.newRequestQueue(this);
JSONObject jsonRequest = new JSONObject();
try {
jsonRequest.put("GetTopic",Request.Method.GET );
} catch (JSONException e) {
e.printStackTrace();
}
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(jsonURL,jsonRequest,
new Response.Listener<JSONObject>() {
// Takes the response from the JSON request
#Override
public void onResponse(JSONObject response) {
try {
JSONObject obj = response.getJSONObject("GetTopic");
// Retrieves the string labeled "colorName" and "description" from
//the response JSON Object
//and converts them into javascript objects
String color = obj.getString("GetTopic");
// Adds strings from object to the "data" string
String data = "Topic Name: " + color ;
// Adds the data string to the TextView "results"
// results.setText(data);
courseList[0] = data;
courseList[1] = data;
courseList[2] = data;
// Toast.makeText(getApplicationContext(),data,Toast.LENGTH_LONG).show();
}
// Try and catch are included to handle any errors due to JSON
catch (JSONException e) {
// If an error occurs, this prints the error to the log
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
#Override
// Handles errors that occur due to Volley
public void onErrorResponse(VolleyError error) {
Log.e("Volley", "Error");
}
});
requestQueue.add(jsonObjectRequest);
CustomAdapter customAdapter = new CustomAdapter(getApplicationContext(), courseList, flags);
}

OkHttp not working as it should

I am fairly new to Android Dev and I created a Google Form and wanted to implement the form on my app and I heard about the open source okhttp from Square Open Source, which you most likely know
So, I created a layout with the labels, gave them the same IDs and everything...
I created a java class called Form and inserted all the code, and no errors whatsoever.
(Worth mentioning I am using navigation drawer activity, don't know if that influences or not though)
So after implementing and correcting everything there was to correct, I ran the application but it just doesnt do anything. It does not do the validation nor it sends the response.
I would really appreciate if anyone could help me out with this
I will leave the code here
Once again, thanks.
package com.example.eduardobastos.testapp;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
public class Form extends AppCompatActivity {
public static final MediaType FORM_DATA_TYPE
= MediaType.parse("application/x-www-form-urlencoded; charset=utf-8");
//URL derived from form URL
public static final String URL="https://docs.google.com/forms/d/e/1FAIpQLSeZp9wjprZJ3OR2SkIHHsZE9yDBAVnC7mO8hPKSzwGuYhqmdw/formResponse";
//input element ids found from the live form page
public static final String EMAIL_KEY="entry_943499687";
public static final String SUBJECT_KEY="entry_2058392291";
public static final String MESSAGE_KEY="entry_1420026128";
private Context context;
private EditText emailEditText;
private EditText subjectEditText;
private EditText messageEditText;
#Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.form_layout);
//save the activity in a context variable to be used afterwards
context =this;
//Get references to UI elements in the layout
Button sendButton = (Button)findViewById(R.id.sendButton);
emailEditText = (EditText)findViewById(R.id.emailEditText);
subjectEditText = (EditText)findViewById(R.id.subjectEditText);
messageEditText = (EditText)findViewById(R.id.messageEditText);
sendButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
//Make sure all the fields are filled with values
if(TextUtils.isEmpty(emailEditText.getText().toString()) ||
TextUtils.isEmpty(subjectEditText.getText().toString()) ||
TextUtils.isEmpty(messageEditText.getText().toString()))
{
Toast.makeText(context,"All fields are mandatory.",Toast.LENGTH_LONG).show();
return;
}
//Check if a valid email is entered
if(!android.util.Patterns.EMAIL_ADDRESS.matcher(emailEditText.getText().toString()).matches())
{
Toast.makeText(context,"Please enter a valid email.",Toast.LENGTH_LONG).show();
return;
}
//Create an object for PostDataTask AsyncTask
PostDataTask postDataTask = new PostDataTask();
//execute asynctask
postDataTask.execute(URL,emailEditText.getText().toString(),
subjectEditText.getText().toString(),
messageEditText.getText().toString());
}
});
}
//AsyncTask to send data as a http POST request
private class PostDataTask extends AsyncTask<String, Void, Boolean> {
#Override
protected Boolean doInBackground(String... contactData) {
Boolean result = true;
String url = contactData[0];
String email = contactData[1];
String subject = contactData[2];
String message = contactData[3];
String postBody="";
try {
//all values must be URL encoded to make sure that special characters like & | ",etc.
//do not cause problems
postBody = EMAIL_KEY+"=" + URLEncoder.encode(email,"UTF-8") +
"&" + SUBJECT_KEY + "=" + URLEncoder.encode(subject,"UTF-8") +
"&" + MESSAGE_KEY + "=" + URLEncoder.encode(message,"UTF-8");
} catch (UnsupportedEncodingException ex) {
result=false;
}
try{
//Create OkHttpClient for sending request
OkHttpClient client = new OkHttpClient();
//Create the request body with the help of Media Type
RequestBody body = RequestBody.create(FORM_DATA_TYPE, postBody);
Request request = new Request.Builder()
.url(url)
.post(body)
.build();
//Send the request
Response response = client.newCall(request).execute();
}catch (IOException exception){
result=false;
}
return result;
}
#Override
protected void onPostExecute(Boolean result){
//Print Success or failure message accordingly
Toast.makeText(context,result?"Message successfully sent!":"There was some error in sending message. Please try again after some time.",Toast.LENGTH_LONG).show();
}
}
}
Just tested this, and works like a charm...
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v4.widget.TextViewCompat;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import butterknife.BindView;
import butterknife.ButterKnife;
import mx.com.iisi.staffing.R;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
public class MessageActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_message);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}
#Override
protected void onResume() {
super.onResume();
new PostDataTask(this).execute("","testing#testing.com","Testing","Testing message");
}
private class PostDataTask extends AsyncTask<String, Void, Boolean> {
public final MediaType FORM_DATA_TYPE
= MediaType.parse("application/x-www-form-urlencoded; charset=utf-8");
//URL derived from form URL
public static final String URL="https://docs.google.com/forms/d/e/1FAIpQLSeZp9wjprZJ3OR2SkIHHsZE9yDBAVnC7mO8hPKSzwGuYhqmdw/formResponse";
//input element ids found from the live form page
public static final String EMAIL_KEY="entry_943499687";
public static final String SUBJECT_KEY="entry_2058392291";
public static final String MESSAGE_KEY="entry_1420026128";
private Context context;
public PostDataTask(Context context)
{
this.context = context;
}
#Override
protected Boolean doInBackground(String... contactData) {
Boolean result = true;
String url = contactData[0];
String email = contactData[1];
String subject = contactData[2];
String message = contactData[3];
String postBody="";
try {
//all values must be URL encoded to make sure that special characters like & | ",etc.
//do not cause problems
postBody = EMAIL_KEY+"=" + URLEncoder.encode(email,"UTF-8") +
"&" + SUBJECT_KEY + "=" + URLEncoder.encode(subject,"UTF-8") +
"&" + MESSAGE_KEY + "=" + URLEncoder.encode(message,"UTF-8");
} catch (UnsupportedEncodingException ex) {
result=false;
}
try{
//Create OkHttpClient for sending request
OkHttpClient client = new OkHttpClient();
//Create the request body with the help of Media Type
RequestBody body = RequestBody.create(FORM_DATA_TYPE, postBody);
Request request = new Request.Builder()
.url(URL)
.post(body)
.build();
//Send the request
Response response = client.newCall(request).execute();
}catch (IOException exception){
result=false;
}
return result;
}
#Override
protected void onPostExecute(Boolean result){
Toast.makeText(context,result?"Message successfully sent!":"There was some error in sending message. Please try again after some time.",Toast.LENGTH_LONG).show();
}
}
}

sending data from device to remote server

My application is passing two value from device to remote server but it work in when i tested in bluestack when I install in real device it show a message like "Unfortunately app has been stooped" so I can't under stand where is problem i delete and clean device temporary and cache memory of device still not getting output.
following is my source code
package com.androidexample.httpgetexample;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import org.apache.http.client.HttpClient;
import org.apache.http.client.ResponseHandler;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.DefaultHttpClient;
import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
public class HttpGetAndroidExample extends Activity {
TextView content;
EditText fname,email,login,pass;
Spinner sp;
Button b1;
String s[] = { "Courtage Problem", "Cartage Refil", "Printer Problem",
"Printer Drivers" };
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_http_get_android_example);
content = (TextView)findViewById(R.id.content);
fname = (EditText)findViewById(R.id.name);
sp = (Spinner)findViewById(R.id.spinner1);
ArrayAdapter<String> ad = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, s);
sp.setAdapter(ad);
ad.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
Button saveme=(Button)findViewById(R.id.save);
saveme.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v)
{
//ALERT MESSAGE
Toast.makeText(getBaseContext(),
"Please wait, connecting to server.",
Toast.LENGTH_LONG).show();
try{
String n = URLEncoder.encode(fname.getText().toString(), "UTF-8");
String d = URLEncoder.encode(sp.getSelectedItem().toString(), "UTF-8");
HttpClient Client = new DefaultHttpClient();
String URL = "http://shreebijapur.in/Customerquery.aspx?n="+n+"&d="+d;
//Log.i("httpget", URL);
try
{
HttpGet httpget = new HttpGet(URL);
ResponseHandler<String> responseHandler = new BasicResponseHandler();
String SetServerString = "";
SetServerString = Client.execute(httpget, responseHandler);
content.setText(SetServerString);
}
catch(Exception ex)
{
content.setText("Fail!");
}
}
catch(UnsupportedEncodingException ex)
{
content.setText("Fail111");
}
}
});
}
}
It's probably crashing due to the networkOnMainThreadException. I'm trying to executr an http request in an inner class that extends class AsyncTask.
I put all network related stuff in the doInBackground() method.
If Error: networkOnMainThreadException
Perform http request execution in an inner class that extends the class AsyncTask.
or
new AsyncTask<Void, Void, Void>() {
#Override
protected void onPreExecute() {
super.onPreExecute();
}
#Override
protected Void doInBackground(Void... params) {
// HERE_YOUR_HTTP_REQUEST CODE
return null;
}
#Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
}
}.execute();
Try this
Or
You can use volley, retrofit or other networking library's for API call.

Categories

Resources