[android-developers] Re: Start activity within a thread
Hey Dilirao - Could you give a more elaborate example. I did something like you mentioned but it didnt work. Maybe I did something wrong Rohit On Feb 24, 1:56 am, dillirao malipeddi dillir...@arijasoft.com wrote: create a handler like sample code final Handler mHandler = new Handler(); Runnable MyActivity= new Runnable() { public void run() { startMyActivity(); } }; in your thread use mHandler.post(MyActivity); and in startMyActivity() {} UI changes or new Activity loading etc... you can do the work as your wish -- it's necessary to stop the progress On Tue, Feb 24, 2009 at 2:53 PM, Rohit mord...@gmail.com wrote: What do you mean by use handler to start the activity. could you give me some example code? rohit On Feb 24, 1:21 am, Rohit mord...@gmail.com wrote: well y is an instance of of my class and foo() is defined by me so I start an activity, however, the caller (from the thread.run()) method is not something that I do. I just noticed someone calling it like that (from the Thread.run() method) and it was not working, hence my question...Is the problem that it is being called from a thread or that there is a progree dialog being showed? or neither? Rohit On Feb 23, 8:06 pm, dillirao malipeddi dillir...@arijasoft.com wrote: you must stop the progress by dialog by dismissdialog() and from your thread you must use handler to start an activity the right way to start any UI tasks in the thread is by using handlers On Tue, Feb 24, 2009 at 5:46 AM, Rohit mord...@gmail.com wrote: There is an activity that shows a progress dialog and starts a new thread to do some work. One method that is called from this thread starts a new activity. i.e. ThreadX has a run() method that calls y.foo(). y.foo() starts a new activity with teh flag Intent.FLAG_ACTIVITY_NEW_TASK When I run this - I see the progress dialog but I dont see the new activity starting up from within the thread. All the context information is present to the thread. Thanks Rohit -- Dilli Rao. M ARIJASOFT +91 - 9703073540 -- Dilli Rao. M ARIJASOFT +91 - 9703073540 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Start activity within a thread
I think the problem is that the activity I want to do is not started in startMyActivity() but by a method that is called from startMyActivity() public void run() { someObject.method(); } SomeObject.method(){ //This starts the new activity } Rohit On Feb 24, 1:56 am, dillirao malipeddi dillir...@arijasoft.com wrote: create a handler like sample code final Handler mHandler = new Handler(); Runnable MyActivity= new Runnable() { public void run() { startMyActivity(); } }; in your thread use mHandler.post(MyActivity); and in startMyActivity() {} UI changes or new Activity loading etc... you can do the work as your wish -- it's necessary to stop the progress On Tue, Feb 24, 2009 at 2:53 PM, Rohit mord...@gmail.com wrote: What do you mean by use handler to start the activity. could you give me some example code? rohit On Feb 24, 1:21 am, Rohit mord...@gmail.com wrote: well y is an instance of of my class and foo() is defined by me so I start an activity, however, the caller (from the thread.run()) method is not something that I do. I just noticed someone calling it like that (from the Thread.run() method) and it was not working, hence my question...Is the problem that it is being called from a thread or that there is a progree dialog being showed? or neither? Rohit On Feb 23, 8:06 pm, dillirao malipeddi dillir...@arijasoft.com wrote: you must stop the progress by dialog by dismissdialog() and from your thread you must use handler to start an activity the right way to start any UI tasks in the thread is by using handlers On Tue, Feb 24, 2009 at 5:46 AM, Rohit mord...@gmail.com wrote: There is an activity that shows a progress dialog and starts a new thread to do some work. One method that is called from this thread starts a new activity. i.e. ThreadX has a run() method that calls y.foo(). y.foo() starts a new activity with teh flag Intent.FLAG_ACTIVITY_NEW_TASK When I run this - I see the progress dialog but I dont see the new activity starting up from within the thread. All the context information is present to the thread. Thanks Rohit -- Dilli Rao. M ARIJASOFT +91 - 9703073540 -- Dilli Rao. M ARIJASOFT +91 - 9703073540 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Start activity within a thread
well y is an instance of of my class and foo() is defined by me so I start an activity, however, the caller (from the thread.run()) method is not something that I do. I just noticed someone calling it like that (from the Thread.run() method) and it was not working, hence my question...Is the problem that it is being called from a thread or that there is a progree dialog being showed? or neither? Rohit On Feb 23, 8:06 pm, dillirao malipeddi dillir...@arijasoft.com wrote: you must stop the progress by dialog by dismissdialog() and from your thread you must use handler to start an activity the right way to start any UI tasks in the thread is by using handlers On Tue, Feb 24, 2009 at 5:46 AM, Rohit mord...@gmail.com wrote: There is an activity that shows a progress dialog and starts a new thread to do some work. One method that is called from this thread starts a new activity. i.e. ThreadX has a run() method that calls y.foo(). y.foo() starts a new activity with teh flag Intent.FLAG_ACTIVITY_NEW_TASK When I run this - I see the progress dialog but I dont see the new activity starting up from within the thread. All the context information is present to the thread. Thanks Rohit -- Dilli Rao. M ARIJASOFT +91 - 9703073540 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Start activity within a thread
create a handler like sample code final Handler mHandler = new Handler(); Runnable MyActivity= new Runnable() { public void run() { startMyActivity(); } }; in your thread use mHandler.post(MyActivity); and in startMyActivity() {} UI changes or new Activity loading etc... you can do the work as your wish -- it's necessary to stop the progress On Tue, Feb 24, 2009 at 2:53 PM, Rohit mord...@gmail.com wrote: What do you mean by use handler to start the activity. could you give me some example code? rohit On Feb 24, 1:21 am, Rohit mord...@gmail.com wrote: well y is an instance of of my class and foo() is defined by me so I start an activity, however, the caller (from the thread.run()) method is not something that I do. I just noticed someone calling it like that (from the Thread.run() method) and it was not working, hence my question...Is the problem that it is being called from a thread or that there is a progree dialog being showed? or neither? Rohit On Feb 23, 8:06 pm, dillirao malipeddi dillir...@arijasoft.com wrote: you must stop the progress by dialog by dismissdialog() and from your thread you must use handler to start an activity the right way to start any UI tasks in the thread is by using handlers On Tue, Feb 24, 2009 at 5:46 AM, Rohit mord...@gmail.com wrote: There is an activity that shows a progress dialog and starts a new thread to do some work. One method that is called from this thread starts a new activity. i.e. ThreadX has a run() method that calls y.foo(). y.foo() starts a new activity with teh flag Intent.FLAG_ACTIVITY_NEW_TASK When I run this - I see the progress dialog but I dont see the new activity starting up from within the thread. All the context information is present to the thread. Thanks Rohit -- Dilli Rao. M ARIJASOFT +91 - 9703073540 -- Dilli Rao. M ARIJASOFT +91 - 9703073540 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Start activity within a thread
The activity that has the thread running is not written by me but by someone else and I cannot control what goes in there. My question is why is the activity that I start from my method never being started. Progress dialogs are not blocking right? Rohit On Feb 24, 1:56 am, dillirao malipeddi dillir...@arijasoft.com wrote: create a handler like sample code final Handler mHandler = new Handler(); Runnable MyActivity= new Runnable() { public void run() { startMyActivity(); } }; in your thread use mHandler.post(MyActivity); and in startMyActivity() {} UI changes or new Activity loading etc... you can do the work as your wish -- it's necessary to stop the progress On Tue, Feb 24, 2009 at 2:53 PM, Rohit mord...@gmail.com wrote: What do you mean by use handler to start the activity. could you give me some example code? rohit On Feb 24, 1:21 am, Rohit mord...@gmail.com wrote: well y is an instance of of my class and foo() is defined by me so I start an activity, however, the caller (from the thread.run()) method is not something that I do. I just noticed someone calling it like that (from the Thread.run() method) and it was not working, hence my question...Is the problem that it is being called from a thread or that there is a progree dialog being showed? or neither? Rohit On Feb 23, 8:06 pm, dillirao malipeddi dillir...@arijasoft.com wrote: you must stop the progress by dialog by dismissdialog() and from your thread you must use handler to start an activity the right way to start any UI tasks in the thread is by using handlers On Tue, Feb 24, 2009 at 5:46 AM, Rohit mord...@gmail.com wrote: There is an activity that shows a progress dialog and starts a new thread to do some work. One method that is called from this thread starts a new activity. i.e. ThreadX has a run() method that calls y.foo(). y.foo() starts a new activity with teh flag Intent.FLAG_ACTIVITY_NEW_TASK When I run this - I see the progress dialog but I dont see the new activity starting up from within the thread. All the context information is present to the thread. Thanks Rohit -- Dilli Rao. M ARIJASOFT +91 - 9703073540 -- Dilli Rao. M ARIJASOFT +91 - 9703073540 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Start activity within a thread
Actually, progress dialog will kind of blocking your UI thread. So yes, for Android, using handler to post a message to UI thread is one of the ways to ensure some code will be executed in UI's thread when the HandleMessge is invoked by the plaftorm in your UI thread. What this means is that you can put your UI thread code in the HandleMessage method in your case. On Feb 24, 11:05 am, Rohit mord...@gmail.com wrote: The activity that has the thread running is not written by me but by someone else and I cannot control what goes in there. My question is why is the activity that I start from my method never being started. Progress dialogs are not blocking right? Rohit On Feb 24, 1:56 am, dillirao malipeddi dillir...@arijasoft.com wrote: create a handler like sample code final Handler mHandler = new Handler(); Runnable MyActivity= new Runnable() { public void run() { startMyActivity(); } }; in your thread use mHandler.post(MyActivity); and in startMyActivity() {} UI changes or new Activity loading etc... you can do the work as your wish -- it's necessary to stop the progress On Tue, Feb 24, 2009 at 2:53 PM, Rohit mord...@gmail.com wrote: What do you mean by use handler to start the activity. could you give me some example code? rohit On Feb 24, 1:21 am, Rohit mord...@gmail.com wrote: well y is an instance of of my class and foo() is defined by me so I start an activity, however, the caller (from the thread.run()) method is not something that I do. I just noticed someone calling it like that (from the Thread.run() method) and it was not working, hence my question...Is the problem that it is being called from a thread or that there is a progree dialog being showed? or neither? Rohit On Feb 23, 8:06 pm, dillirao malipeddi dillir...@arijasoft.com wrote: you must stop the progress by dialog by dismissdialog() and from your thread you must use handler to start an activity the right way to start any UI tasks in the thread is by using handlers On Tue, Feb 24, 2009 at 5:46 AM, Rohit mord...@gmail.com wrote: There is an activity that shows a progress dialog and starts a new thread to do some work. One method that is called from this thread starts a new activity. i.e. ThreadX has a run() method that calls y.foo(). y.foo() starts a new activity with teh flag Intent.FLAG_ACTIVITY_NEW_TASK When I run this - I see the progress dialog but I dont see the new activity starting up from within the thread. All the context information is present to the thread. Thanks Rohit -- Dilli Rao. M ARIJASOFT +91 - 9703073540 -- Dilli Rao. M ARIJASOFT +91 - 9703073540 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Start activity within a thread
you must stop the progress by dialog by dismissdialog() and from your thread you must use handler to start an activity the right way to start any UI tasks in the thread is by using handlers On Tue, Feb 24, 2009 at 5:46 AM, Rohit mord...@gmail.com wrote: There is an activity that shows a progress dialog and starts a new thread to do some work. One method that is called from this thread starts a new activity. i.e. ThreadX has a run() method that calls y.foo(). y.foo() starts a new activity with teh flag Intent.FLAG_ACTIVITY_NEW_TASK When I run this - I see the progress dialog but I dont see the new activity starting up from within the thread. All the context information is present to the thread. Thanks Rohit -- Dilli Rao. M ARIJASOFT +91 - 9703073540 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---