Server not able to read parameters while making a webservice connection - android

I am connecting to .net webservice using below code,i am able to connect and get incomplete response from server.I am adding userId has parameter with '1' has value of type string.The issue is 'server is not able to read the parameters at all i am sending in request' .I am not sure if something is wrong on my side.I have attached the webservice request and response and my code.
and my android connecting code
private class AsyncCallWS extends AsyncTask<String, Void, Void> {
#Override
protected Void doInBackground(String... params) {
//Invoke webservice
displayText=WebService.invokeHelloWorldWS(editText,"GetReminder");
return null;
}
#Override
protected void onPostExecute(Void result) {
//Set response
tv.setText(displayText);
//Make ProgressBar invisible
pg.setVisibility(View.INVISIBLE);
}
#Override
protected void onPreExecute() {
//Make ProgressBar invisible
pg.setVisibility(View.VISIBLE);
}
#Override
protected void onProgressUpdate(Void... values) {
}
}
webservice called here.
public class WebService {
//What is the Namespace of the Webservice ??
private static String NAMESPACE = "http://tempuri.org";
//Webservice URL
private static String URL = "http://1.3.44.5:8080/csmmobileapi/service.asmx";
//SOAP Action URI ???
private static String SOAP_ACTION = "http://tempuri.org/GetReminder";
private static final String TAG=null;
public static String invokeHelloWorldWS(String name, String webMethName)
{
boolean result=false;
String resTxt = null;
// Create request
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
SoapObject request = new SoapObject(NAMESPACE, webMethName);
envelope.setOutputSoapObject(request);
androidHttpTransport.debug=true;
// Property which holds input parameters
PropertyInfo sayHelloPI = new PropertyInfo();
// Set Name
sayHelloPI.setName("UserId");
// Set Value
sayHelloPI.setValue("1");
// Set dataType
sayHelloPI.setType(String.class);
// Add the property to request object
request.addProperty(sayHelloPI);
//Set envelope as dotNet
envelope.dotNet = true;
try {
// Invoke web service
androidHttpTransport.call(SOAP_ACTION, envelope);
// Get the response
String response=androidHttpTransport.responseDump;
Log.d("Result --- ", response.toString() );
//tried with SoapObject and SoapPrimitive
SoapObject obj=(SoapObject)envelope.getResponse();
Log.d("Result --- ", obj);
System.out.println("obj---->" + obj.toString());
}

Did a very silly mistake,i found out after doing so much trial n error work..,
private static String NAMESPACE = "http://tempuri.org"; changed to private static String NAMESPACE = "http://tempuri.org/"; and everything worked well.

Related

Return an Array of Strings from an ASP.NET Web Service to an Android client using SOAP

I want to return an array of strings to my Android client and populate a ListView.
I am using the SOAP library (org.ksoap2.*) to invoke an ASP.NET web service.
Here is the code for the web service:
1. ASP Web Service
Imports ...
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports ...
<WebService(Namespace:="...")>_
<WebService(ConformsTo:=...)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class EnquiryWS
Inherits System.Web.Services.WebService
' Web method
<WebMethod()> _
Public Function GetList() As String()
'Hardcoded list
Return New String() { "item1", "item2", "item3" }
End Function
I've tested the web service by accessing the asmx, there are no runtime errors.
I've also tested it with just a simple string, the web service returned the string to Android. Like this:
' Web method
<WebMethod()> _
Public Function GetString() As String
Return "My string."
End Function
2. Android Activity
Secondly, here is my Android code that is invoking the ASP.NET web service.
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapPrimitive;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
public class MainActivity extends AppCompatActivity {
private ArrayList<String> list;
private ListView listview;
private ArrayAdapter<String> adapter;
#Override
protected void onCreate(Bundle savedInstanceState) {
//...
new GetPersonList().execute("AsyncTask String");
//...
}
// Inner AsyncTask class
private class GetPersonList extends AsyncTask<String, Integer,String> {
private static final String SOAP_ACTION = "https://myNamespace/GetList";
private static final String METHOD_NAME = "GetList";
private static final String NAMESPACE = "https://myNamespace/";
private static final String URL =
"https://myIISsite/myASMXfile.asmx";
#Override
protected void onPreExecute() {
super.onPreExecute();
// onPreExecute stuff
}
#Override
protected String doInBackground(String... arg) {
String result = null;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
//Create envelope
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
//Required for .net
envelope.dotNet = true;
//Set output SOAP object
envelope.setOutputSoapObject(request);
//Create HTTP call object
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
//Invoke web service
androidHttpTransport.call(SOAP_ACTION, envelope);
//Get the response
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
//Assign it to response to a static variable
result = response.toString();
} catch (Exception e) {
result = "error " + e.getMessage();
}
return result;
}
#Override
protected void onPostExecute(String result) {
System.out.println("Returned SOAP XML: " + result);
MyFunction(result);
}
}
}
MyFunction is a method that I created to do some additional work.
3. MyFunction
Here is MyFunction method code:
public void MyFunction(String s) {
// Add Webservice response to list
list.add(s);
// Set adapter
adapter = new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_list_item1, list);
listview.setAdapter(adapter);
}
The argument I pass to MyFunction is the SOAP response, I then add it to the list and set the adapter.
Okay, so the web service is returning an array of strings, but the overriden onPostExecute method is working with one string, if I declare the onPostExecute parameter as a Collection, it is obviously not overriding anymore.
This is the error that I am getting in logcat:
Return SOAP XML: error expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope (position:START_TAG <html>#1:7 in java.io.InputStreamReader#4182d238)
Could anyone please advise?
I have found a solution. I am casting the response as a SoapObject and not as a SoapPrimitive, the reason for that is because a SoapPrimitive is for primitive data types, SoapObject supports composite data types. Therefore, I am casting my array as a SoapObject and not as a SoapPrimitive anymore.
I have removed the MyFunction() method, because I am setting the adapter in the onPostExecute() method by override run(). And finally, I have added a ProgressDialog, I am showing the ProgressDialog in the onPreExecute() method while it's processing, and then I am invoking dismiss() in the onPostExecute() method.
private class GetPersonList extends AsyncTask<Void, Void, String> {
private static final String SOAP_ACTION = "http://myNamespace/myMethod";
private static final String METHOD_NAME = "myMethod";
private static final String NAMESPACE = "http://myNamespace/";
private static final String URL =
"http://myURL/myAsmxFile.asmx";
ProgressDialog progressDialog;
#Override
protected void onPreExecute() {
super.onPreExecute();
progressDialog= ProgressDialog.show(MainActivity.this,
"Wait",
"Retrieving data",
true
);
}
#Override
protected String doInBackground(Void... params) {
String finalResult = null;
//Create request object
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
//Create envelope to which we add our request object
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
//Required for .net
envelope.dotNet = true;
//Add the request object to the envelope
envelope.setOutputSoapObject(request);
//Create HTTP call object
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
//Invoke web service
androidHttpTransport.call(SOAP_ACTION, envelope);
// Get the response
// Cast as SoapObject and not SoapPrimitive
SoapObject response = (SoapObject) envelope.getResponse();
//Assign it to response to a static variable
finalResult = response.toString();
// Now loop through the response (loop through the properties)
// and add them to the list
for(int i = 0; i < response.getPropertyCount(); i++) {
list.add(response.getProperty(i).toString());
}
} catch (Exception e) {
System.out.println("######## ERROR " + e.getMessage());
}
return finalResult;
}
#Override
protected void onPostExecute(String str) {
progressDialog.dismiss();
System.out.println("Returned SOAP XML: " + str);
runOnUiThread(new Runnable() {
#Override
public void run() {
// Set adapter
adapter = new ArrayAdapter<String>(MainActivity.this, R.layout.list_item, R.id.product_name, list);
listview.setAdapter(adapter);
}
});
}
}
I have heard that there is another way of doing this using Gson/Json, I will post that once I have figured it out.
Cheerz

Calling webservice on Android

Tried using Async but got can't handler even there is no toast in it,
also tried call calling method runUIThread but no luck ,
Async method works but it also gets run time exception
when i use Async method data gets on the Textview too late (5-10 mins) , but when i use it in debuggers it gets instantly ,
below webservice is test using wizdl application and response is instant
i'm confused please help
private final String NAMESPACE = "http://????????.com/EventGetter/";
private final String URL = "http://?????????.com/EventGetter.asmx";
private final String SOAP_ACTION = "http://????????.com/EventGetter/GetTimeTable";
private final String METHOD_NAME = "GetTimeTable";
private class TPaccessData extends AsyncTask<String, Void, Void>{
#Override
protected Void doInBackground(String... params) {
GetData();
return null;
}
#Override
protected void onPostExecute(Void result) {
Log.i(LogStr, "onPostExecute");
}
#Override
protected void onPreExecute() {
GetData();
Log.i(LogStr, "onPreExecute");
}
#Override
protected void onProgressUpdate(Void... values) {
Log.i(LogStr, "onProgressUpdate");
}
}
public void GetData(){
//Create request
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
//set properties aka param
request.addProperty("stream","where ttBatch = 'F.Y.J.C'");
//Create envelope
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
//Set output SOAP object
envelope.setOutputSoapObject(request);
//Create HTTP call object
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try {
androidHttpTransport.debug = true;
//Invole web service
androidHttpTransport.call(SOAP_ACTION, envelope);
//Get the response
SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
//Assign it to Text static variable
text.setText(response.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
also tried calling get data in oncreate method
NotifyList.this.runOnUiThread(new Runnable() {
#Override
public void run() {
GetData();
// TPaccessData task = new TPaccessData();
// task.execute();
}
});
Remove youe GetData() method from onPreExecute()
and call this line inside onPost
text.setText(response.toString());

java.lang.IllegalArgumentException: size <= 0 using ksoap2 library for consuming the WCF .SVC SOAP Web service

Thanks in advance please forgive me if I am making any mistake while explaining the problem.
I am new TO SOAP technology. I want to call a WCF .net based SOAP web service the request for the SOAP will look something like below
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:IsServiceLive_V>
<!--Optional:-->
<tem:version>1</tem:version>
</tem:IsServiceLive_V>
</soapenv:Body>
</soapenv:Envelope>
and I am trying to make the request in the code like this
public class MainActivity extends Activity {
public static String SOAP_ACTION1="http://tempuri.org/IService1/IsServiceLive_V";
public static String SOAP_ACTION2="http://tempuri.org/IService1/IsServiceLive_V";
public static String METHOD_NAME1="IsServiceLive_V";
public static String METHOD_NAME2="IsServiceLive_V";
public static String NAMESPACE="http://tempuri.org/";
public static String URL="http://64.27.48.117:3340/service/Service1.svc?wsdl";
Button btnFar,btnCel,btnClear;
EditText txtFar,txtCel;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btnFar = (Button)findViewById(R.id.btnFar);
btnCel = (Button)findViewById(R.id.btnCel);
btnClear = (Button)findViewById(R.id.btnClear);
txtFar = (EditText)findViewById(R.id.txtFar);
txtCel = (EditText)findViewById(R.id.txtCel);
btnFar.setOnClickListener(new View.OnClickListener()
{
#Override
public void onClick(View v)
{
//Initialize soap request + add parameters
try
{
new SoapResult(1).execute();
}
catch(NullPointerException e)
{
}
}
});
}
public class SoapResult extends AsyncTask<Void, Void, SoapObject>
{
int flag_status;
SoapObject final_result;
public SoapResult(int flag) {
// TODO Auto-generated constructor stub
flag_status=flag;
}
#Override
protected SoapObject doInBackground(Void... arg0) {
// TODO Auto-generated method stub
if(flag_status==1)
{
//Initialize soap request + add parameters
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME1);
//Use this to add parameters
/* PropertyInfo property=new PropertyInfo();
property.setName("tmp");
property.setValue("GetRestaurantList");
request.addProperty(property);*/
request.addProperty("version", "1");
//Declare the version of the SOAP request
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
System.out.println(request.toString());
envelope.dotNet = true;
try {
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
//this is the actual part that will call the webservice
androidHttpTransport.call(SOAP_ACTION1, envelope);
System.out.println("ok");
// Get the SoapResult from the envelope body.
SoapObject result = (SoapObject)envelope.bodyIn;
System.out.println(result.toString());
//SoapResult soap=(SoapResult)envelope.getResponse();
//Get the first property and change the label text
final_result=result;
} catch (Exception e) {
e.printStackTrace();
System.out.println("hiiii...");
}
return final_result;
}
#Override
protected void onPostExecute(SoapObject result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
if(flag_status==1)
//txtCel.setText(result.getProperty(0).toString());
if(flag_status==0)
{
// txtFar.setText(result.getProperty(0).toString());
}
}
}
and the SOAP response in SOAP format should look something like this
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<IsServiceLive_VResponse xmlns="http://tempuri.org/">
<IsServiceLive_VResult>true</IsServiceLive_VResult>
</IsServiceLive_VResponse>
</s:Body>
</s:Envelope>
but it is giving me exception java.lang.IllegalArgumentException: size <= 0
after the call
androidHttpTransport.call(SOAP_ACTION1, envelope);
The XML SOAP request and responses are generated using Soup UI tool and are working fine
just not getting where i am going wrong a little bit help would be appreciable..
Once I was having the same issue. There might be some problem with your service.
And use this
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER12);
Instead of
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
Got the answer for what i was looking for . for the WCF web services we have to create separate class for each method to get the data since it cannot be run from the code where you wanted the results . So if anyone has the problem that I faced please do remember that to consume the WCF web service in your android project Create a different class for each method for the web service .I am giving an simple example below
public class GetNearBy {
public static String HOTEL_NAME="hotel_name";
public static String NUMBER_OF_BRANCHES="branches";
public static String IMAGE1="image1";
public static String IMAGE2="image2";
public static String IMAGE3="image3";
public static String IMAGE4="image4";
public static String IMAGE5="image5";
public static String IMAGE6="image6";
public static String HAS_EVENT="HasEvent";
public static String HAS_OFFER="HasOffer";
public static String HAS_MENU="HasMenu";
public static String HAS_POPULARFOOD="HasPopularFood";
public static String ID="Id";
public static String IS_OPEN="IsOpen";
public static String LAT="LAT";
public static String LONG="LONG";
public static String LOCATION="Location";
public static String STARS="Stars";
public static String FACILITY_COUNT="facility_count";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String METHOD_NAME = "GetNearBy";
private static final String SOAP_ACTION = "http://tempuri.org/IService1/GetNearBy";
private static final String URL = "http://xxxxxx/service/Service1.svc/soap";
public static ArrayList<HashMap<String, String>> connectToSOAPService()
{
ArrayList<HashMap<String, String>> data=new ArrayList<HashMap<String,String>>();
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
// creating SOAP envelope
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
// this should be true even in not .NET services
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
String resultValue = "";
try {
// calling an action
androidHttpTransport.call(SOAP_ACTION, envelope);
// receiving response
SoapObject response = (SoapObject) envelope.getResponse();
for(int i=0;i<response.getPropertyCount();i++)
{
HashMap<String, String> result=new HashMap<String, String>();
SoapObject ele1=(SoapObject)response.getProperty(i);
String Hotel_name=ele1.getProperty("BranchName").toString();
result.put(HOTEL_NAME, Hotel_name);
data.add(result);
}
}
catch(Exception e)
{
}
return data;
}
}
and just call it from where you need to fetch the result from the WCF web service like this
GetNearBy.connectToSOAPService();
try like this
final String NAMESPACE = con.getResources().getString(
R.string.NAMESPACE);
final String METHOD_NAME = "ItemsByCountry";
final String SOAP_ACTION = con.getResources().getString(
R.string.SOAP_ACTION)
+ METHOD_NAME;
final String URL = con.getResources().getString(R.string.URL);
SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
Request.addProperty("userId", UserId);
Request.addProperty("countryName", countryName);
SoapSerializationEnvelope soapEnvelop;
soapEnvelop = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelop.dotNet = true;
soapEnvelop.setOutputSoapObject(Request);
HttpTransportSE htp = new HttpTransportSE(URL);
htp.call(SOAP_ACTION, soapEnvelop);
response = (SoapObject) soapEnvelop.getResponse();

How I Can Send An Array to WebService Method

i need to send a multiple values to a webservice -asp.net- via android application
this is the webservice method
<WebMethod()> _
Public Function AddTheNums(ByVal nums() As String,) As String
For i = 0 To nums.Length - 1
--some process
Next
Return status
End Function
and i use this code to in android
public class Login extends AsyncTask<String, Void, String>
{
public Login(String MethodName)
{
}
public void onPreExecute()
{
}
#Override
protected String doInBackground(String... params)
{
final SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("nums", params[0]);
request.addProperty("nums", params[1]);
final SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
try
{
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive result = (SoapPrimitive) envelope.getResponse();
response = result.toString();
}
return response;
}
#Override
public void onPostExecute(String res)
{
}
}
can any one help me on this i need to send a multiple nums to the parameter in webserive
i used this code
request.addProperty("nums", params[0]);
request.addProperty("nums", params[1]);
but it doesnt work correctly ...
Best Regards
I'm not really sure that it's possible to use multiple params with same name in soapobject. Isn't it better to pass param like
request.addProperty("nums", params);
And I suppose this discussion can help https://groups.google.com/forum/#!topic/ksoap2-android/pq1V2ZXY3D8

How can I make a ksoap2 call in async task?

I am a newbie on android development. I am trying to develop an application which will connect with .net webservice in order to retrieve data. I would like to make the ksoap2 call with AsyncTask. How I call it asyncronus with asynctask?
My SoapCall class is
public class SoapCall {
public final static String SOAP_ACTION = "http://www.alpha.net.com/ExecuteEBSCommand";
public final static String OPERATION_NAME = "ExecuteEBSCommand";
public final static String NAMESPACE = "http://www.alpha.net.com";
public final static String URL = "http://192.168.2.100/Ebs2Alpha/Service.asmx";
public String connection(String Command, String CommandParameters) throws Throwable, Throwable {
String response = null;
SoapObject Request = new SoapObject(NAMESPACE, OPERATION_NAME);
Request.addProperty("strCommand", Command);
Request.addProperty("strCommandParameters", CommandParameters);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(Request);
// Needed to make the internet call
// Allow for debugging - needed to output the request
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
// this is the actual part that will call the webservice
androidHttpTransport.call(SOAP_ACTION, soapEnvelope);
// Get the SoapResult from the envelope body.
SoapObject result = (SoapObject) soapEnvelope.bodyIn;
response = result.getProperty(0).toString();
return response;
}
}
So far I am getting the response by calling the connection method in main activity with
SoapCall call1= new SoapCall();
call1.connection("get_clients", "%");
Using AsyncTask is straightforward. Here is an example.
public class MyTask extends AsyncTask<String, Integer, String>{
#Override
protected String doInBackground(String... params) {
String response = null;
SoapObject Request = new SoapObject(NAMESPACE, OPERATION_NAME);
Request.addProperty("strCommand", params[0]);
Request.addProperty("strCommandParameters", params[1]);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(Request);
// Needed to make the internet call
// Allow for debugging - needed to output the request
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.debug = true;
// this is the actual part that will call the webservice
androidHttpTransport.call(SOAP_ACTION, soapEnvelope);
// Get the SoapResult from the envelope body.
SoapObject result = (SoapObject) soapEnvelope.bodyIn;
response = result.getProperty(0).toString();
return response;
}
}
And the call to the task with parameters.
MyTask myTask = new MyTask();
myTask.execute(new String[] {Command, CommandParameters});
Hope it will help.
I'd suggest you use the AsyncTaskLoader which for my taste is easier than the AsyncTask.
Have a look here, the example is very extensive and looks intimidating at first, you'll probably find much simpler ones. The idea is that your Activity implements LoaderCallbacks for the creation of the loader and a method that is being called when the loader has finished. You 'start' a loader via the LoaderManager.
The AsynctaskLoader is a class that extends AsyncTaskLoader and does the asynchronous stuff.
I'll give you a simple example:
This is the AsyncTaskLoader:
public class StartupLoader extends AsyncTaskLoader<Boolean> {
Context context;
public StartupLoader(Context context) {
super(context);
this.context = context;
forceLoad();
}
#Override
public Boolean loadInBackground() {
// DO STUFF!
return true;
}
#Override
protected void onStopLoading() {
}
#Override
public void onCanceled(Boolean data) {
super.onCanceled(data);
}
#Override
protected void onReset() {
super.onReset();
}
}
This is what you have in the Activity that will start the loader, it is an inner class:
public class StartupCallback implements
LoaderManager.LoaderCallbacks<Boolean> {
#Override
public void onLoadFinished(Loader<Boolean> loader, Boolean succ) {
// Here you get your results back
}
#Override
public Loader<Boolean> onCreateLoader(int id, Bundle args) {
return new StartupLoader(getApplicationContext());
}
#Override
public void onLoaderReset(Loader<Boolean> loader) {
}
}
And this is how you start the loader from whereever you want (within that Activity):
StartupCallback startupCallback = new StartupCallback();
getSupportLoaderManager().initLoader(0, null, startupCallback);
where 0 is an ID that you give the loader, null is a Bundle of arguments.
Good luck :)

Categories

Resources