Create handler in thread which has not called Looper.prepare

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Create handler in thread which has not called Looper.prepare

Postby javame_android » Sat Apr 04, 2009 9:55 am

Hi All,

I am trying to download a file from url and I have written code for writing to file.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. Context con = threadSession.getAndroidPlayer().getApplicationContext();
  3.  
  4. FileOutputStream fout = con.openFileOutput("aqua.q3z", Context.MODE_PRIVATE);
  5.  
  6. fout.write(buffer, 0, length);
  7.  
  8.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


This code gets execute in different thread and when I run this program I get the following error

In catch for writing file Can't create handler inside thread that has not called Looper.prepare()

W/System.err( 417): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()

W/System.err( 417): at android.os.Handler.<init>(Handler.java:111)

W/System.err( 417): at android.app.Activity.<init>(Activity.java:660)

W/System.err( 417): at com.qedsoft.player.impl.AndroidPlayer.<init>(AndroidPlayer.java:13)

W/System.err( 417): at com.qedsoft.streamerclient.impl.CStreamingSession.getAndroidPlayer(CStreamingSession.java:261)

W/System.err( 417): at com.qedsoft.streamerclient.impl.SessionDataCollector.getData(CStreamingSession.java:344)

W/System.err( 417): at com.qedsoft.streamerclient.impl.SessionDataCollector.run(CStreamingSession.java:358)

Can anyone suggest me what shall be the problem?

I hope to get the reply as soon as possible.



Thanks & Regards
Sunil
javame_android
Junior Developer
Junior Developer
 
Posts: 19
Joined: Wed Mar 25, 2009 11:00 am
Location: Ahmedabad

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 6 guests