Good afternoon.
I need from time to time do a check on a server, because I'm not using
AsyncTask do not need no update from my view.
Then I used a Handler that runs a thread from time to time, and this thread
makes access to the server. In Honeycomb versions running down blz, already
in top get
On Tue, Jan 29, 2013 at 10:47 AM, Diego N. diegonunes.sist...@gmail.comwrote:
Someone uses a different strategy to do this kind of task?
AlarmManager.
-
TreKing
i have one problem with handling the thread in android ,in my class i have
to create one thread which create some UI after that thread finish i will
get some value ,here i want to wait my Main Process until the thread
complete it process but when i put wait() or notify in Main process thread
If you create a Thread in an activity, does it generally live beyond a call
to onPause?
--
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
On Fri, Nov 30, 2012 at 3:10 PM, bob b...@coolfone.comze.com wrote:
If you create a Thread in an activity, does it generally live beyond a
call to onPause?
Why wouldn't it? Write a simple test and see for yourself.
Yes, with the caveat that if you're doing this it might not be such a good
idea.
In Android, you might be better fit with creating a Service that mediates
interaction between the Activity and the background thread, that or using
an asynctask.
kris
On Fri, Nov 30, 2012 at 4:10 PM, bob
What do you normally do on Android when you spawn a thread but the thread
needs to access
your Activity object? Do you typically pass the Activity object to your
own constructor for the Thread?
--
You received this message because you are subscribed to the Google
Groups Android
That's probably unsafe due to the lifecycle of activities. What's the use case?
Larry
On Fri, Sep 7, 2012 at 10:18 AM, bob b...@coolfone.comze.com wrote:
What do you normally do on Android when you spawn a thread but the thread
needs to access
your Activity object? Do you typically pass
The use case is that the thread may want to call Activity.startActivity().
On Friday, September 7, 2012 11:35:50 AM UTC-5, Larry Meadors wrote:
That's probably unsafe due to the lifecycle of activities. What's the use
case?
Larry
On Fri, Sep 7, 2012 at 10:18 AM, bob
I'm guessing here a little bit, but is this what you want?:
The user is in ActivityA. THe user clicks on a button or does something
that requires a background Thread to do so processing.
When the Thread is done (successfully), the thread needs to spawn/start
ActivityB
If so,
use an AsyncTask.
Streets has it right: You probably want an AsyncTask. Using an AsyncTask
has several important advantages: it uses a thread pool instead of
creating and destroying threads and it also imposes order on things: tasks
are executed in the order in which they are started.
If you actually need a
Hi all,
I have created a thread using C++ under mediaserver application.
When I am doing 'top' it is showing only cpu usage of all including
'mediaserver' but the newly created thread.
can someone help how to get thread level cpu consumption for the newly
created thread.
--
You received this
I have a working audio input app that uses the AudioRecord class for
low-level PCM continuous audio processing. The audio stream is read
and analyzed by a separate thread which repeatedly calls
audioRecord.read to process the microphone audio one block at a time.
Currently I create and start up
Hi,
I created a service to read information from the serial port. I start
a thread that actually does all the reading from the serial port. It
runs for about 10 minutes and then it just stops. No exceptions
thrown, no errors on logcat.
The question is - how i can make sure that the thread keeps
On Sun, Mar 18, 2012 at 3:44 PM, svl s.i.vladimi...@googlemail.com wrote:
The question is - how i can make sure that the thread keeps running?
You can't, not without any guarantee.
Another solution was to do it with a handler and run the read from
serial port every second. Unfortunately
Hello,
We are using threads in our app, to ask for an xml and some remote
images which load on our activity's listview. This activity also uses
Tabs, so when we click on the tab buttons the info on the listview is
updated.
However, in certain occasions we get a Fatal Error: Asynctask #1 (or
2, or
Hello,
how can I access the UI from a other thread?
My scenario:
in my activity I create and start a thread, which continously has to
do various tasks in the background. On some of this tasks it is
necessary to update the UI. To do this I am calling a method in my
Task. The problem no is, that
Try using runOnUiThread().
Thanks
On Sun, Dec 18, 2011 at 5:08 PM, QuR rainer.qu...@gmx.de wrote:
Hello,
how can I access the UI from a other thread?
My scenario:
in my activity I create and start a thread, which continously has to
do various tasks in the background. On some of this
Hi,
I am using thread in my activity class.when the activity is visible
there isnt any problem.but when i navigate to previous screen and
again going to this activity it causes forced close to my app.I have
tried it by removing the thread then it works fine.
Here is the code that i m calling
here is an important question about thread UI , and please need help
in it
http://stackoverflow.com/questions/6162756/thread-ui-problem-w-android-and-python-while-sending-data
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this
http://123maza.com/65/rings780/ http://123maza.com/65/rings780/
http://123maza.com/65/rings780/ http://123maza.com/65/rings780/
http://123maza.com/65/rings780/
On Apr 30, 1:54 am, a a harvey.a...@gmail.com wrote:
I'm modifying the app Gallery3D on android. Meet an issue about thread.
I'm modifying the app Gallery3D on android. Meet an issue about thread.
There have a DataSouce class which child class object hold the datasouce.
MediaFeed is implement the Runnable, and also have a datasouce object.
Now, a create a new thread in the datasouce which i wan't to get other
data
new PersonnelLookUpTask();// start task..choose where u want to start
it..oncreate or button click..ur choice.
Input|Progress(u can ignore this parameter)|Output
private class YourLookUpTask extends AsyncTaskString,Void
,ArrayListPersonnelObject{
@Override
protected
Hello, i'm trying to do some work in a thread while showing a progress
dialog until the work is done in the most simple possible way, so far
i got this:
// this is the current activity
final ProgressDialog prgDialog = ProgressDialog.show(this, ,
Working..., true, false);
new
On Tue, Apr 5, 2011 at 11:45 PM, SD315 sailer...@gmail.com wrote:
Hello, i'm trying to do some work in a thread while showing a
progress dialog until the work is done in the most simple possible way
Use AsyncTask.
Hi everybody!
First, sorry if my English is bad, usually i don't use it...
I am making a program witch have 2 java class. The first class is the
main activity and the second is a thread.
In the main activity i have some ImageViews, Textviews, CheckBox and
RadioButtons. My Problem is that when i
Marc,
You cannot directly call UI functions in Android from a background thread:
http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html#Threads
This explains how you can trigger UI updates:
http://developer.android.com/resources/articles/timed-ui-updates.html
--
When I set *yourThread.instanceBooleanAttribute = false;* , the Thread may
be sleeping. How to destroy a sleeping thread?
thanks,Krishna
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to
If the thread is sleep()-ing or wait()-ing, call notify() to wake it up.
-- Kostya
07.03.2011 8:39, Krishna Shetty ?:
When I set *yourThread.instanceBooleanAttribute = false;* , the
Thread may be sleeping. How to destroy a sleeping thread?
thanks,Krishna
--
You received this message
I have a function call from a large engine (which I can not change)
which asks the user whether to save or not. Before this function call
returns, I need an answer from the user whether to save.
There is, as far as I know, no way to start an activity (or show a
dialog) that synchronously returns
startActivity() always runs the activity on the main thread.
How about just looking at your app in the debugging to see where the threads
are stuck?
On Wed, Dec 22, 2010 at 7:11 AM, Schoel samuelsson.j...@gmail.com wrote:
I have a function call from a large engine (which I can not change)
Just to add my two cents:
You didn't include information on what s_Semaphore is, but I'm guessing
it's from java.concurrent.
Although I'm not too familiar with this package, the docs say this:
http://download.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/Semaphore.html
Conceptually,
Oh, and one more thing: the activity not getting displayed likely has
something to do with the thread going into a wait state right after you
call startActivity.
Since the call to queryUserSave comes from background thread (as I
understand from your email), you could use runOnUIThread() with
On Wed, Dec 22, 2010 at 10:11 AM, Schoel samuelsson.j...@gmail.com wrote:
I have a function call from a large engine (which I can not change)
which asks the user whether to save or not. Before this function call
returns, I need an answer from the user whether to save.
Ask the save/no-save
22.12.2010 22:15, Mark Murphy пишет:
activity run on the main application
thread (which you are blocking)
Mark,
I don't believe this is the case.
In fact, Schoel wrote this in his original message:
I've checked the thread id of the thread in which queryUserSave is
called and the thread id
Ah, sorry, I missed that.
On Wed, Dec 22, 2010 at 2:58 PM, Kostya Vasilyev kmans...@gmail.com wrote:
22.12.2010 22:15, Mark Murphy пишет:
activity run on the main application
thread (which you are blocking)
Mark,
I don't believe this is the case.
In fact, Schoel wrote this in his
Hi,
I am implementing a testcase in Android Juint. I am facing problem in
handling threads. After the successful running of a test case, it will
not wait for child thread to be finished. e.g. If one testcase call
some services in server. testcase will successfully send request to a
server, but it
Hi,
I am implementing a testcase in Android Juint. I am facing problem in
handling threads. After the successful running of a test case, it will
not wait for child thread to be finished. e.g. If one testcase call
some services in server. testcase will successfully send request to a
server, but it
Good day,
I am writing a program that uses a UDP poort to listen to information
send from a system. First the users sees an activity that allows them
to close the activity or start it on a port they can select (edittext)
The port is checked and if correct a new activity is launched. This
display
Hi All,
I want to write a separate Thread within my application(to do
Bluetooth connection). Any idea where I can find any reference for
help to write Threads in Android?
I searched online but could not find any proper reference.
Thanks In Advance,
Perumal
--
You received this message because
Try AsyncTask
On Wed, Aug 4, 2010 at 4:43 PM, perumal316 perumal...@gmail.com wrote:
Hi All,
I want to write a separate Thread within my application(to do
Bluetooth connection). Any idea where I can find any reference for
help to write Threads in Android?
I searched online but could not
I want to write a separate Thread within my application(to do
Bluetooth connection). Any idea where I can find any reference for
help to write Threads in Android?
http://lmgtfy.com/?q=android+bluetooth+threads
--
You received this message because you are subscribed to the Google
Groups
-developers@googlegroups.com [mailto:android-
develop...@googlegroups.com] On Behalf Of brijesh
Sent: Thursday, June 17, 2010 3:40 AM
To: Android Developers
Subject: [android-developers] Thread Problem
Hello,
I want to stop currently running thread but -Thread.stop() -
Thread.destroy
Hi Brijesh,
You have a *while(true){...}*, haven't you?
Change it to:
*while(instanceBooleanAttribute){...}*
Now, you can stop the Thread process from another Class, simply
calling *yourThread.instanceBooleanAttribute
= false;*.
Roc Boronat from Barcelona
http://piposerver.com
--
You
Hello,
I want to stop currently running thread but -Thread.stop() -
Thread.destroy() are DEPRECATED so can any one tell me how to stop the
Thread
--
Regards,
Brijesh Masrani
--
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to
In your thread you probably have something like:
public void run () {
while (true) {
doSomeWork();
}
}
what you need is a boolean var that checks whether to continue 'doing work',
or stop the thread. Like this:
public void run () {
while (!stopThread) {
doSomeWork();
Hi
In my application I created a service in which I download stuff from the
internet.
The code of the service looks like this:
class SomeService ... {
@Override
public void onCreate() {
super.onCreate();
Thread t = new Thread(fetch);
t.start();
}
private
I have a time consuming task i don't want to run in the main UI thread, so
i
do the following (pseudo-code):
onClick:
getresults()
public void getresults():
TextView tv;
String result = dolongjob()
tv.setText(result);
public void dolongjob():
Robin van Leeuwen wrote:
I have a time consuming task i don't want to run in the main UI thread,
so i
do the following (pseudo-code):
onClick:
getresults()
public void getresults():
TextView tv;
String result = dolongjob()
Hello,
I use a thread for drawing to the canvas. By coincidence I recognized
that in the program always jumps into the finally part. After
view.onDraw(c); is reached it steps back to synchronized
(surfaceHolder) and then it steps into the finally part. This happens
every time. This means to me
Occasionally I see thread execution hiccups on my Motorola Droid
(currently running 2.1 but I saw it with 2.0.1, too). Normally my
dummy thread (full tilt, foreground, not doing *anything* else) runs
in about 5-6mS. However, I see a second hump around 13-14mS and
stragglers anywhere out to 80mS
A new thread is created to do some time-consuming tasks and may take a
long time, When the thread is active, the orientation of the phone is
changed, the activity will be killed and re-created. How about the
thread? Will the thread be destoryed?
Hi All ,
I have started a thread from one Activity and then i have started
another activit from parent Activity . Now my Parrent Activity is in
pause state .
but what will happen to thread that I have started from parrent . I
belive it will continuenot going in sleep state
any
Hi,
i use a Thread to make buttons visible for some seconds. If the
location change, the buttons should gets visible for x seconds.
My code:
dialog = new Thread (new Runnable()
{
public void run()
{
try
{
Is there a way to monitor the resource usages of a Thread in Android?
Resources of interest include CPU, memory, etc. It doesn't seem like
ManagementFactory or ThreadMXBean are supported in Android. Are there
other options?
I would want to do this at runtime, from within a deployed
hello,
how can i trigger in tread A a methode from thread B? the methode
schould be than executetd in thread b.
I want to manipulate within a thread A a View from Thread B, how can i
do that?
rgds
mr.no
--~--~-~--~~~---~--~~
You received this message because
Hi,
I have a question.
--~--~-~--~~~---~--~~
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
Hi,
I have a question.
If I have a list which has many url links. I want to download all
url. How should I do? There are two solutions:
1) use only one thread to download all links. It needs a while
loop. for example,
int i=0;
while(ilist.length){
Hi,
My appWidget is working well.
When it's installed and used by user, a Thread is launched to refresh
view (like a flipper).
Even if the screen is off, the thread is continuing...perfect for
me...
But after 3 minutes, it's stopped.
Does it a VM restriction avoiding some bad development usage?
Hi all,
I am developing a simple application with thread concept
problem:
In one thread i write
{
Thread.sleep(1) //10 sec sleep
m_handler.post(my_runnable); // to post to run another
runnable
}
before the thread wake up ( 10 sec) i stopped
Hi Guys,
Just a quick general question someone might be able to answer off the
top of their head, does the JVM scheduler use time slicing when
allocating process to threads of the same priority?
Cheers,
Greg B.
--~--~-~--~~~---~--~~
You received this message
Hi,
I've an Activity A that starts a Thread T which download a file
through HTTP. It works fine. If I close my Activity (back button)
while downloading, it is destroyed (onDestroy called) but download
Thread still continue and download is completed fine.
For testing purposes I've moved my
Consider the following:-
0Handler mHandler = ...
1Foo foo = new Foo( a );
2Message.obtain( mHandler, 1, foo ).sendToTarget();
Many threads will be calling line #2 using the shared Handler. Is this
thread safe ?
Regards,
Gavin
--~--~-~--~~~---~--~~
63 matches
Mail list logo