I'am following this tutorial for calling a web service in android & it works great, http://androidexample.com/Restful_Webservice_Call_And_Get_And_Parse_JSON_Data-_Android_Example/index.php?view=article_discription&aid=101
yet when i try to call another webservice using this code, just replacing the serverURL, the app gets blocked in th pre-execute(), can anyone tell me what else should I change ? I thought there was a common code for all web services ?
mainActivity.java
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLEncoder;
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button GetData = (Button) findViewById(R.id.GetServerData);
GetData.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// WebServer Request URL
String serverURL = "http://androidexample.com/media/webservice/JsonReturn.php";
// String serverURL = "http://hmkcode.appspot.com/rest/controller/get.json";
// String serverURL="http://gdata.youtube.com/feeds/api/videos?q=Android&v=2&max-results=20&alt=jsonc&hl=en";
// Use AsyncTask execute Method To Prevent ANR Problem
new LongOperation().execute(serverURL);
}
}
);
}
class LongOperation extends AsyncTask<String, Void, Void> {
private final HttpClient Client = new DefaultHttpClient();
private String Content;
private String Error = null;
private ProgressDialog Dialog = new ProgressDialog(MainActivity.this);
String data = "";
TextView uiUpdate = (TextView) findViewById(R.id.output);
TextView jsonParsed = (TextView) findViewById(R.id.jsonParsed);
protected void onPreExecute() {
// NOTE: You can call UI Element here.
//Start Progress Dialog (Message)
Dialog.setMessage("Please wait..");
Dialog.show();
}
// Call after onPreExecute method
protected Void doInBackground(String... urls) {
/************ Make Post Call To Web Server *********/
BufferedReader reader=null;
// Send data
try
{
// Defined URL where to send data
URL url = new URL(urls[0]);
// Send POST data request
URLConnection conn = url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
wr.write( data );
wr.flush();
// Get the server response
reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuilder sb = new StringBuilder();
String line = null;
// Read Server Response
while((line = reader.readLine()) != null)
{
// Append server response in string
sb.append(line + " ");
}
// Append Server Response To Content String
Content = sb.toString();
}
catch(Exception ex)
{
Error = ex.getMessage();
}
finally
{
try
{
reader.close();
}
catch(Exception ex) {}
}
/*****************************************************/
return null;
}
protected void onPostExecute(Void unused) {
// NOTE: You can call UI Element here.
// Close progress dialog
Dialog.dismiss();
if (Error != null) {
uiUpdate.setText("Output : " + Error);
} else {
// Show Response Json On Screen (activity)
uiUpdate.setText(Content);
//String OutputData = MainActivity.parse(Content);
//Show Parsed Output on screen (activity)
//jsonParsed.setText(OutputData);
}
}
}
}
I changed send PostRequest with this code: //SEND Get data reques HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET");& it works
Related
I am trying to get a JSON Array from this local server for five days:
localhost/match_picture/service.php?action=read
and i can't do it !!
I search it in google and read too many documentations !
here is my code:
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class WebService {
public static String readUrl(String server_url) {
BufferedReader bufferedReader = null;
try {
URL url = new URL(server_url);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
StringBuilder sb = new StringBuilder();
bufferedReader = new BufferedReader(new InputStreamReader(con.getInputStream()));
String json;
while ((json = bufferedReader.readLine()) != null) {
sb.append(json+"\n");
}
return sb.toString();
}catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
and it's Main_Activity:
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
public class Activity_main extends AppCompatActivity {
private ArrayList<StructAcount> netAcount = new ArrayList<StructAcount>();
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
String result= WebService.readUrl("http://localhast/match_picture/service.php?action=read");
if (result != null) {
try {
JSONArray tasks = new JSONArray(result);
for (int i=0; i<tasks.length(); i++) {
StructAcount acount= new StructAcount();
JSONObject object = tasks.getJSONObject(i);
acount.id = object.getLong("user_id");
acount.name = object.getString("user_name");
acount.email = object.getString("user_email");
netAcount.add(acount);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
for (StructAcount acount: netAcount) {
Toast.makeText(Activity_main.this, "username: " + acount.name + "\n" + "useremail: " + acount.email , Toast.LENGTH_SHORT).show();
}
}
}
it is runing on emulator and crashes in this line:
bufferedReader = new BufferedReader(new InputStreamReader(con.getInputStream()));
and i dont know why ...
I am Searching for five days!!!!
I can do it with HttpClient
but i want to be update
I saw a vidoe in youtube that create a class in Main_Activity extends AsyncTask and make connenction in doInBackground(String... params). I try that and that works correcly. but because I want to do it in anoder class (WebService) and I dont know how can i sent result to Main_Activity , I remove that class extended from AsyncTask.
thank's for your help
sorry for my poor english
You have a NetworkOnMainThreadException to begin with.
And your app crashes.
Google how to solve it.
I am trying to send some data to web database using AsyncTask but it gives me error in this line in preExecute method when i try to initialize progress dialog.
dialog = new ProgressDialog(MainActivity.this, R.style.CustomAlertDialogStyle)
Error about MainActivity.this saying "mainactivity is not an enclosing class".
Here is my full code.
package com.cplusplusapp.rashidfaheem.hybridsoftwaresolutions.hbss.rashidfaheem.webservice;
import android.app.ProgressDialog;
import android.content.Context;
import android.net.Uri;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.Toast;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.HttpURLConnection;
import javax.net.ssl.HttpsURLConnection;
public class MainActivity extends AppCompatActivity {
Spinner sp;
Button signup, login;
EditText edtname, edtemail, edtaddress, edtpassword, edtphone, edtcity;
String name,pass,add,catagory,phone,email,city;
ArrayAdapter<String> adapter;
String[] options = {"Student", "Teacher"};
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
signup = (Button) findViewById(R.id.signup);
login = (Button) findViewById(R.id.login);
edtname = (EditText) findViewById(R.id.edtname);
edtemail = (EditText) findViewById(R.id.edtemail);
edtaddress = (EditText) findViewById(R.id.edtaddress);
edtpassword = (EditText) findViewById(R.id.edtpassword);
edtphone = (EditText) findViewById(R.id.edtphone);
edtcity = (EditText) findViewById(R.id.edtcity);
sp = (Spinner) findViewById(R.id.sp);
adapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, options);
sp.setAdapter(adapter);
login.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
}
});
signup.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
String permission="false";
new adduser().execute(edtname.getText().toString(), edtemail.getText().toString(), edtpassword.getText().toString(),
edtcity.getText().toString(), edtphone.getText().toString(), edtaddress.getText().toString(), permission, sp.getSelectedItem().toString());
}
});
}
}
class adduser extends AsyncTask<String, String, String>{
Context mcontext;
ProgressDialog dialog;
HttpURLConnection conn;
URL url=null;
#Override
protected void onPreExecute() {
super.onPreExecute();
dialog = new ProgressDialog(MainActivity.this, R.style.CustomAlertDialogStyle);
dialog.setMessage("Registering User, Please Wait");
dialog.setCancelable(false);
dialog.show();
}
#Override
protected String doInBackground(String... strings) {
try{
// Enter URL address where your php file resides
url=new URL("http://127.0.0.1/rashid/signup.php");
}catch (MalformedURLException e){
e.printStackTrace();
}
try {
// Setup HttpURLConnection class to send and receive data from php and mysql
conn = (HttpURLConnection) url.openConnection();
conn.setReadTimeout(10000);
conn.setConnectTimeout(15000);
conn.setRequestMethod("POST");
// setDoInput and setDoOutput method depict handling of both send and receive
conn.setDoInput(true);
conn.setDoOutput(true);
// Append parameters to URL
Uri.Builder builder = new Uri.Builder();
builder.appendQueryParameter("customer_name", strings[0]);
builder.appendQueryParameter("customer_email", strings[1]);
builder.appendQueryParameter("customer_pass", strings[2]);
builder.appendQueryParameter("customer_city", strings[3]);
builder.appendQueryParameter("customer_contact", strings[4]);
builder.appendQueryParameter("customer_address", strings[5]);
builder.appendQueryParameter("permission", strings[6]);
builder.appendQueryParameter("category", strings[7]);
String query = builder.build().getEncodedQuery();
// Open connection for sending data
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream(), "UTF-8"));
writer.write(query);
writer.flush();
writer.close();
conn.connect();
} catch (IOException e){
e.printStackTrace();
} catch (Exception e){
e.printStackTrace();
}
try{
int code = conn.getResponseCode();
// Check if successful connection made
if (code== HttpsURLConnection.HTTP_OK){
// Read data sent from server
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
StringBuilder result = new StringBuilder();
String line;
while ((line=reader.readLine())!=null){
result.append(line);
}
// Pass data to onPostExecute method
return (result.toString());
} else {
return ("unsuccessfull");
}
}catch (IOException e){
e.printStackTrace();
return ("Exception");
} finally {
conn.disconnect();
}
}
#Override
protected void onPostExecute(String result) {
dialog.dismiss();
if (result.equalsIgnoreCase("true")){
/* Here launching another activity when login successful. If you persist login state
use sharedPreferences of Android. and logout button to clear sharedPreferences.
*/
Toast.makeText(mcontext, "Registered Successfully", Toast.LENGTH_LONG).show();
} else if (result.equalsIgnoreCase("false")){
// If username and password does not match display a error message
Toast.makeText(mcontext, "Register First", Toast.LENGTH_LONG).show();
} else if (result.equalsIgnoreCase("Exception")|| result.equalsIgnoreCase("Unsuccessful")){
Toast.makeText(mcontext, "OOPs! Something went wrong. Connection Problem.", Toast.LENGTH_LONG).show();
}
}
}
You are trying to access a class (MainActivity) that is inside it's own file from another class that is in its own file (adduser) . There is no way to do that - how is one class supposed to know about the other's instance magically? What you can do:
Move the AsyncTask so it is an inner class in MainActivity
Pass off your Activity to the AsyncTask (via its constructor) then acess using activityVariable.findViewById(); (I am using mActivity in the example below) Alternatively, your ApplicationContext (use proper naming convention, the A needs to be lowercase) is actually an instance of MainActivity you're good to go, so do ApplicationContext.findViewById();
Using the Constructor example:
public class adduser extends AsyncTask<Context, String, ArrayList<Card>>
{
Context ApplicationContext;
Activity mActivity;
public adduser (Activity activity)
{
super();
mActivity = activity;
}
i Edited all my previous question . I solved that long time ago .
but now i am here and just getting all things done :
i have a login activity :
which makes a call to rest api with credentials .
i have created the login activity it works ok but i have to press the button two times in order to perform some action . i think there is a mistake in my code :
here is my login activity ... if anyone can help me in this i will accept it as answer and will close this link on my stickies....
login.java:
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.HttpResponse;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.List;
public class login_act extends Activity {
private ProgressDialog pDialog;
List<NameValuePair> params=null;
static String response = null;
private String url = "http://hostname_ip/rest-api/xxxxx/?format=json";
static String u="";
static String p="";
String temp= "";
// User name
private EditText et_Username;
// Password
private EditText et_Password;
// Sign In
private Button bt_SignIn;
// Message
private TextView tv_Message;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login_layout);
// Initialization
et_Username = (EditText) findViewById(R.id.u_name);
et_Password = (EditText) findViewById(R.id.password);
bt_SignIn = (Button) findViewById(R.id.sign_in);
tv_Message = (TextView) findViewById(R.id.statusop);
bt_SignIn.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View view) {
// Stores User name
String username = String.valueOf(et_Username.getText());
u=username;
// Stores Password
String password = String.valueOf(et_Password.getText());
p=password;
new Getlogin().execute();
}
});
}
private class Getlogin extends AsyncTask<Void, Void, Void> {
#Override
protected void onPreExecute() {
super.onPreExecute();
// Showing progress dialog
pDialog = new ProgressDialog(login_act.this);
pDialog.setMessage("Signing In...");
pDialog.setCancelable(false);
pDialog.show();
}
#Override
protected Void doInBackground(Void... arg0) {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpEntity httpEntity = null;
HttpResponse httpResponse = null;
String credentials = u + ":" + p;
try {
if (params != null) {
String paramString = URLEncodedUtils
.format(params, "utf-8");
url += "?" + paramString;
}
HttpGet httpGet = new HttpGet(url);
String base64EncodedCredentials = Base64.encodeBytes(credentials.getBytes());
httpGet.addHeader("Authorization", "Basic " + base64EncodedCredentials);
httpResponse = httpClient.execute(httpGet);
httpEntity = httpResponse.getEntity();
temp = response = EntityUtils.toString(httpEntity);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
#Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
// Dismiss the progress dialog
if (pDialog.isShowing())
try {
pDialog.dismiss();
if(temp.contains("count")){
tv_Message.setText("Logged In");
Intent go = new Intent(login_act.this,Scnd.class);
Bundle extras = new Bundle();
extras.putString("status", response);
extras.putString("user", u);
extras.putString("pass", p);
// 4. add bundle to intent
go.putExtras(extras);
startActivity(go);
finish();
}else
tv_Message.setText("Invalid username or password");
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
}
i only want if user and pass are ok then intent to new activity . if the user pasword are wrong then display response with incorect user password
but the activity performs it by clicking twice a button . i want to make it single click.. any help ?? i would be thankful.
You need to have an installation of Newfies-Dialer in order to use the API, in other words the API url will be the one from your own server.
The documentation clearly say API URL => http://HOSTNAME_IP/rest-api/campaigns/
I'm trying to connect to a servlet in localhost from my Android Emulator.
I created a project in Eclipse named SimpleHttpGetRequest with an activity named "HttpGetServletActivity".
I created in NetBeans a project named "HttpGetRequest" containing a servlet.
The code in my "HttpGetServletActivity" activity is :
package com.mobdev.simplehttprequest;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class HttpGetServletActivity extends Activity implements OnClickListener {
Button button;
TextView outputText;
public static final String URL = "http://10.0.2.2:8080/HttpGetRequest/HelloWorldServlet";
/** Called when the activity is first created. */
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewsById();
button.setOnClickListener(this);
}
private void findViewsById() {
button = (Button) findViewById(R.id.button);
outputText = (TextView) findViewById(R.id.outputTxt);
}
public void onClick(View view) {
GetXMLTask task = new GetXMLTask();
task.execute(new String[]{ URL });
}
private class GetXMLTask extends AsyncTask<String, Void, String> {
#Override
protected String doInBackground(String... urls) {
String output = null;
for (String url : urls) {
output = getOutputFromUrl(url);
}
return output;
}
private String getOutputFromUrl(String url) {
StringBuffer output = new StringBuffer("");
try {
InputStream stream = getHttpConnection(url);
BufferedReader buffer = new BufferedReader(
new InputStreamReader(stream));
String s = "";
while ((s = buffer.readLine()) != null)
output.append(s);
} catch (IOException e1) {
e1.printStackTrace();
}
return output.toString();
}
// Makes HttpURLConnection and returns InputStream
private InputStream getHttpConnection(String urlString)
throws IOException {
InputStream stream = null;
URL url = new URL(urlString);
URLConnection connection = url.openConnection();
try {
HttpURLConnection httpConnection = (HttpURLConnection) connection;
httpConnection.setRequestMethod("get");
httpConnection.connect();
if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
stream = httpConnection.getInputStream();
}
} catch (Exception ex) {
ex.printStackTrace();
}
return stream;
}
#Override
protected void onPostExecute(String output) {
outputText.setText(output);
}
}
}
The source code of my servlet is :
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class HelloWorldServlet extends HttpServlet {
public HelloWorldServlet() {
super();
}
#Override
protected void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
out.println("Hello Android !!!!");
}
}
I deployed my servlet in Apache server (i'm using xampp);
I added permission for network connection
When I run my App and click on the button, the App crashes, and I don't know why !!
Can anybody help me, please ? Im' stuck.
I tried :
Wifi connection : I did run my App on a real device, instead of "10.0.2.2" I put the ip adress of my PC but it doesn't work ;
Access to project HttpGetrequest from Android Emulator browser, it worked ;
This is probably not very elegant, but what I'm trying to do is connect to a web service, fetch the JSON, parse it, create an object out of it, add that object to an ArrayList and then use that ArrayList to populate my ListView.
I'm trying to do all of this with AsyncTask.
SUMMARY: doInBackgroud takes a String of a url, uses it to connect to a web service. I get the JSON data as a string, parse it, construct a new object out of the data, and add it to ArrayList. Then in onPostExecute I'm trying to set the listadapter using an ArrayAdapter that utilizes my ArrayList.
Here's what I have:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import org.json.JSONArray;
import org.json.JSONObject;
import oauth.signpost.OAuthConsumer;
import oauth.signpost.basic.DefaultOAuthConsumer;
import android.app.ListActivity;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.ArrayAdapter;
public class AllOffersListActivity extends ListActivity {
private static final String CONSUMER_KEY = "bla";
private static final String CONSUMER_SECRET = "bla";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
new CreateArrayListTask().execute("http://example.com/sample.json");
}
private class CreateArrayListTask extends AsyncTask<String, Void, ArrayList<Offer>> {
private final ProgressDialog dialog = new ProgressDialog(AllOffersListActivity.this);
#Override
protected void onPreExecute() {
this.dialog.setMessage("Fetching offers...");
this.dialog.show();
}
#Override
protected ArrayList<Offer> doInBackGround(String...urls) {
ArrayList<Offer> offerList = new ArrayList<Offer>();
for(String url: urls) {
OAuthConsumer consumer = new DefaultOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
consumer.setTokenWithSecret("", "");
try {
URL url1 = new URL(url);
HttpURLConnection request = (HttpURLConnection) url1.openConnection();
// sign the request
consumer.sign(request);
// send the request
request.connect();
String JSONString = convertStreamToString(request.getInputStream());
JSONObject jObject = new JSONObject(JSONString);
JSONObject offerObject = jObject.getJSONObject("offer");
String titleValue = offerObject.getString("title");
//System.out.println(titleValue);
String descriptionValue = offerObject.getString("description");
//System.out.println(attributeValue);
JSONObject businessObject = offerObject.getJSONObject("business");
String nameValue = businessObject.getString("name");
Offer myOffer = new Offer(titleValue, descriptionValue, nameValue);
offerList.add(myOffer);
} catch (Exception e) {
e.printStackTrace();
}
}
return offerList;
}
#Override
protected void onPostExecute(ArrayList<Offer> offerList) {
if(this.dialog.isShowing())
this.dialog.dismiss();
setListAdapter(new ArrayAdapter<Offer>(AllOffersListActivity.this, android.R.layout.simple_list_item_1, offerList));
}
}
private String convertStreamToString(InputStream inputStream) throws IOException {
if(inputStream != null) {
Writer writer = new StringWriter();
char[] buffer = new char[1024];
try {
Reader reader = new BufferedReader( new InputStreamReader(inputStream, "UTF-8"));
int n;
while((n = reader.read(buffer)) != -1) {
writer.write(buffer, 0, n);
}
} finally {
inputStream.close();
}
return writer.toString();
} else {
return "";
}
}
}
I'm seeing two errors. One is on my private Async class: "The type AllOffersListActivity.CreateArrayListTask must implement the inherited abstract method AsyncTask<String,Void,ArrayList<Offer>>.doInBackground(String...)"
Secondly, on my doInBackGround Override, I'm getting: The method doInBackGround(String...) of type AllOffersListActivity.CreateArrayListTask must override or implement a supertype method
What am I missing here?
It's just a small typo; should be doInBackground instead of doInBackGround.
#LuxuryMode you have done mistake on doInBackGround
the correct spelling is doInBackground
asynctask must have to implement doInBackground method so it is not recognize this method because of wrong Name of method so it gives you error
The method doInBackGround(String...) of type AllOffersListActivity.CreateArrayListTask must
override or implement a supertype method