AsyncTask : all onProgressUpdate() done at the end of task

by Romain Guy » Sun, 07 Mar 2010 03:12:59 GMT


Sponsored Links
 Hi,

Why are you doing Looper.prepare(); in doInBackground()? Also, what
you are seeing would indeed happen if you are calling get() somewhere
on the UI thread, or otherwise blocking the UI thread after calling
execute() on your task.



>



AsyncTask : all onProgressUpdate() done at the end of task

by Nicolas H » Tue, 09 Mar 2010 23:28:03 GMT


  am doing Looper.prepare(); in doInBackground() because without that,
it seems that exceptions are not catched.
Without that, if I remember, the application simply crashes...

The last call on my UI thread is thread.execute() (during
onCreate()) , so it seems that no get() is called, even if I don't
know what this
function (get) should do.

I changed my code and instead of loading serialized objects, I build
the dictionary and create objects in the background thread.
And the progress bar is correctly filled when each Family object is
created.

For user it takes about the same time as unserialization (I have not
measured exactly), but the apk is about 850ko (due to big xml files)
contrary to 350ko with file containing serialized objects.

On 6 mar, 20:12, Romain Guy <romain...@android.com> wrote:
> >


Sponsored Links


Other Threads

1. Android Google MapView error

Hi everyone!

I've some problem, while trying the Mapview samples. I don't use
Eclipse or any IDE, just console + notepad. Ofc, I've done any
necessary steps:
1) copy the maps.jar into the projects lib directory
2) Edit the AndroidManifest.xml
  a) Grant Internet Access ("android.permission.INTERNET")
  b) import com.google.android.maps, which is in the maps.jar

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.helloandroid">
    <application android:label="@string/app_name"
android:icon="@drawable/icon">
                <uses-library android:name="com.google.android.maps" />
        <activity android:name="com.example.HelloAndroid"
                  android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
        <uses-permission android:name="android.permission.INTERNET" />
</manifest>
--------------------
3) Project target set to "Google Inc.:Google APIs:7", because I want
to try it on a mobile device with Android 2.1
4) Edit the HelloAndroid.java:
package com.example.helloandroid;

import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.widget.RelativeLayout;
import android.app.Activity;
import android.os.Bundle;

public class HelloAndroid extends MapActivity {
        public MapView mapView;
        @Override
        public void onCreate(Bundle icicle) {
          super.onCreate(icicle);
          setContentView(R.layout.main);
          mapView =  (MapView) findViewById(R.id.mapview);
          mapView.setBuiltInZoomControls(true);
        }

        @Override
        protected boolean isRouteDisplayed() {
                return false;
        }
}
------------------------------
5. Edit the main.xml layout file: (I've also tried with LinearLayout
too)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/
android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
<com.google.android.maps.MapView
        android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
        android:apiKey="*************"
/>
</RelativeLayout>

I've tried many sample codes from Android ebooks, www tutorials, etc.

6. I also have a valid API key.

After these steps, the compiling finished with no(!) errors. But, when
I tried it on a device(Virtual and a real mobile too), I got an error
with "activity has stopped unexpectedly". How can I solve this
problem? Thank's for your help :)

< Peter >

-- 

2. java.lang.NoSuchMethodError

Hello.

My name is Javier and I have a question. I included into my Android
project the BouncyCastle source code library.

In one class of mine, I call to the constructor
org.bouncycastle.asn1.cms.ContentInfo:

     public ContentInfo (ASN1ObjectIdentifier contentType,
DEREncodable content) {
        this.contentType = contentType;
        this.content = content;
     }

The class compile, but in running-time I have the following exception:

     java.lang.NoSuchMethodError:
org.bouncycastle.asn1.cms.ContentInfo.<init>

I haven't got .class library, only .java files.

The stacktrace is:

04-04 16:04:29.030: INFO/dalvikvm(847): DexOpt: illegal method access
(call Lorg/bouncycastle/asn1/DERObjectIdentifier;.<init> ([B)V from
Lorg/bouncycastle/asn1/ASN1ObjectIdentifier;)
04-04 16:04:29.030: INFO/dalvikvm(847): Could not find method
org.bouncycastle.asn1.DERObjectIdentifier.<init>, referenced from
method org.bouncycastle.asn1.ASN1ObjectIdentifier.<init>
04-04 16:04:29.030: WARN/dalvikvm(847): VFY: unable to resolve direct
method 38455: Lorg/bouncycastle/asn1/DERObjectIdentifier;.<init> ([B)V
04-04 16:04:29.030: DEBUG/dalvikvm(847): VFY: replacing opcode 0x70 at
0x0000
04-04 16:04:29.040: DEBUG/dalvikvm(847): VFY: dead code 0x0003-0003 in
Lorg/bouncycastle/asn1/ASN1ObjectIdentifier;.<init> ([B)V
04-04 16:04:29.090: INFO/dalvikvm(847): Could not find method
org.bouncycastle.asn1.cms.ContentInfo.<init>, referenced from method
com.galeonsoftware.imae.cliente.core.signers.binary.GenSignedData.generateSignedData
04-04 16:04:29.090: WARN/dalvikvm(847): VFY: unable to resolve direct
method 39015: Lorg/bouncycastle/asn1/cms/ContentInfo;.<init> (Lorg/
bouncycastle/asn1/ASN1ObjectIdentifier;Lorg/bouncycastle/asn1/
DEREncodable;)V
04-04 16:04:29.090: DEBUG/dalvikvm(847): VFY: replacing opcode 0x70 at
0x0097
04-04 16:04:29.090: INFO/dalvikvm(847): Could not find method
org.bouncycastle.asn1.cms.ContentInfo.<init>, referenced from method
com.galeonsoftware.imae.cliente.core.signers.binary.GenSignedData.generateSignedData
04-04 16:04:29.100: WARN/dalvikvm(847): VFY: unable to resolve direct
method 39015: Lorg/bouncycastle/asn1/cms/ContentInfo;.<init> (Lorg/
bouncycastle/asn1/ASN1ObjectIdentifier;Lorg/bouncycastle/asn1/
DEREncodable;)V

Does exist a solution?

Thanks a lot.

-- 

3. Android display driver without a framebuffer device.

4. Widget Update Through Market

5. Where to download ADT 10.0.0 from?

6. Instance state randomly not being restored on orientation changes

7. Own JAR in /system/framework/