last day (39 days later) » 

5:02 PM
hi...ack when you join the room
i am stepping out...will be back in few minutes
 
 
1 hour later…
6:07 PM
    protected String doInBackground(String... urls) {
        int count = 0;
        int numUsers = 0;

        try {
            JSONArray UserJsonArray = connectAndCreateJsonArray(urls[0]);
            numUsers = UserJsonArray.length();
            if (numUsers < 1) return numUsers + "";

            db = new Database(context);
            SQLiteDatabase localDB = db.getWritableDatabase();
            localDB.beginTransaction();
            try {

                for (int i = 0; i < numUsers; i++) {
can you try with above changes
 
hello
can i show you the full code?
however, i'm Umberto, nice to meet you :)
 
sure
just want to see how you invoke asynctask
 
the truth is that i invoke it with 3 urls... i did not say it just to make the question easier
here is the method in which i invoke asynctask: pastebin.com/T30HzY0H
 
downloadTask.cancel(true); change it to downloadTask.cancel(false);
it lets your async task properly cleanup
 
are you sure? someone tells me that it need to close the asynctask
 
6:42 PM
if true it kills...not let it clean up
 
would this fix my problem?
 
both will cancel the asynctask
 
you mean both true and false cancel the asynctask?
 
yes...
 
ok, i trust you :)
 
6:44 PM
well, actually in case of false you need to use the inCancelled i mentioned in my answer
 
@Override
protected void onCancelled() {
dialog.dismiss();
super.onCancelled();
}
 
if (isCancelled()) {
EntityUtils.consume(entity);
client.getConnectionManager().shutdown();
return -1;
}
 
where to put it?
i have to go in 5 minutes... i'm very sorry
can we speak on Skype tomorrow?
 
in your connectAndCreateJsonArray while loop
set cancel(false)...let the connectAndCreateJsonArray function check isCancelled() and return
i do not use skype..this chatroom is privte just post here please
i will check your messages
 
how to contact you tomorrow?
do you mean leave message here?
how does this chat work?
 
6:48 PM
book mark this chatroom url...leave a mssage
 
great
 
this chatroom will be open
SO will notify me
 
The method consume(HttpEntity) is undefined for the type EntityUtils
 
ok
ah...you can comment that out.
the key is return -1
"return -1"
 
while ((line = reader.readLine()) != null) {
stringBuilder.append(line);
if (isCancelled()) {
EntityUtils.consume(entity);
client.getConnectionManager().shutdown();
return -1;
}
}
 
6:50 PM
we exit the function
can you cast the httpentity
 
uhm... it can't return an int
Type mismatch: cannot convert from int to JSONArray
my method return is JSONArray
 
sorry, return your default
i was showing the code base on your original question
 
where you return num
 
i do not understand the cast... where?
 
6:52 PM
consume(entity)
we can comment that out for now
ideally we should close that too
 
so it is not the while loop the place for your code?
i really have to go now
 
actually, instead of you having seperate connectAndCreateJsonArray function, you can just copy-paste / inline that code in your downloadtask
 
i'm very sorry for this
 
no problem
 
i hope we can speak later or tomorrow
 
6:53 PM
lets pick up tomorrow
or later
 
thank you so much
 
take care
 
where are you from?
i'm from Italy :)
 
US
 
cool
which state?
 
6:54 PM
:) WA
 
i googled for WA :P
Whashington?
*Washington
 
yes
 
wow :D
ok see you
bye bye
 
when you message use pacific time
bye
 
what do you mean?
 
6:56 PM
nothing...just referring to the time zone
just leave a message here
 

  last day (39 days later) »