[android-developers] Re: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-08 Thread Ask
Hi all, Thanks 4 ur reply. Actually I want to call some methods of one Activity (test.check.Test1.java) from another activity (my current activity) at runtime in the separate Thread. In the main GUI Thread this works fine. This Test1.java activity resides in the test.check.apk file which is

[android-developers] Re: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-08 Thread Mariano Kamp
Mariano : I have not used Looper.prepare(), Is it required?? If yes then where and how to define handler for that? I honestly don't understand what you're trying to achieve, so it's hard to answer that question. I once tried to inflate GUIs in a separate thread for performance

[android-developers] Re: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-08 Thread Ask
yess right, in short i was trying to instantiate a view comp. Still not clear logic for using Looper. might be Google engineers can answer this. On Apr 8, 6:14 pm, Mariano Kamp mariano.k...@gmail.com wrote: Glad it works. Well, what you were trying to instantiate was a View Component, weren't

[android-developers] Re: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-08 Thread Dianne Hackborn
On Wed, Apr 8, 2009 at 6:51 AM, Ask asifk1...@gmail.com wrote: yess right, in short i was trying to instantiate a view comp. Still not clear logic for using Looper. might be Google engineers can answer this. Do it on the main thread. If you want to actually run UI on another thread, read up

[android-developers] Re: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-08 Thread Streets Of Boston
Maybe your example is simplified, but if this method you want to call (xyz()) is really this simple (i.e. it does not really need a whole activity and all its functionality (Looper and such)), refactor your code and put this 'xyz()' in a class that is not an activity and refer to this class by

[android-developers] Re: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-08 Thread Dianne Hackborn
A view is bound to the thread it is created in. (Actually not view itself, but many subclasses have an internal Handler for scheduling work.) Yes, it can be annoying in some cases, but that's the way it is. On Wed, Apr 8, 2009 at 11:49 AM, Mariano Kamp mariano.k...@gmail.comwrote: Hi Dianne,

[android-developers] Re: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-07 Thread Ask
Is there any handler needed for that?? Any Idea??? On Apr 7, 3:58 pm, Ask asifk1...@gmail.com wrote: Hi, I am using Reflection APIs in the background thread to call a method dynamically from another application but I am getting the Exception: java.lang.RuntimeException: Can't create

[android-developers] Re: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-07 Thread Streets Of Boston
It could be that during the construction of class test.check.Test1, a Handler or something similar (i.e. something needing the main-thread's message-queue) is constructed. Look at your test.check.Test1 implementation and see if this is the case. If this is the case, you will get an exception if

[android-developers] Re: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-07 Thread Ask
Hi Streets, I dont think this is the case. Same code executes nicely If I call that method in the onCreate() method (i.e. main thread itself) problem occurs in the Object creation if I will call this method readTheFile() in the Thread. Can you give any info. regarding how I can define Looper

[android-developers] Re: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-07 Thread Mariano Kamp
I don't want to sound like a smart ass, but did you try what the error message said? Called Looper.prepare()? I know I had a similar situation some time ago and it worked for me. Besides the dreaded BufferedReader exception I find the exceptions I get from the framework very helpful. On Tue,

[android-developers] Re: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-07 Thread Streets Of Boston
But do you want a Looper and Handler in your thread 't'? Why do you load it in another thread? Are you planning in dispatching and handling messages in this thread 't'? If not, don't start adding all this stuff just to make the run-time happy. Put a breakpoint in your default constructor of

[android-developers] Re: Help...Exception in the Background Thread :Can't create handler inside thread that has not called Looper.prepare()

2009-04-07 Thread Dianne Hackborn
Also you need to look at the exception stack trace. It will show you who is trying to create a Handler. On Tue, Apr 7, 2009 at 9:44 AM, Streets Of Boston flyingdutc...@gmail.comwrote: But do you want a Looper and Handler in your thread 't'? Why do you load it in another thread? Are you