English 中文(简体)
Android和read
原标题:Android and threads

我有2个与甲状腺发育和深read有关的问题。

(1) 你们何时认为,我应当利用read子和roid子发育?

(2) 如果我有主线的read子,等待着一些变数,然后再显示一个 to子,那么我就想到的是,在一种能够控制这一变数的螺旋read中,有一把(真实) lo。 现在,如果能够确定变量,那么我如何把方法放在第一线上,显示星座。

非常感谢

最佳回答

在多数情况下,直接使用校对并不必要。 深造的方案规划的roid设施是巨大的,容易使用。

You have about three options to call the UI thread from another thread:

  • Handler - set an handler on the other thread from the UI thread, and send it a message when need.
  • AsyncTask - Perform the main task in background, but modify the UI before, during and after completion.
  • PerformOnUiThread - call this method with a runnable to modify the UI on the UI thread.

阅读好的文章是Painless Threading

问题回答

Never have a while(true) loop that continuously runs. It ll burn massive amounts of resources and, in your case, accomplish very little.

做好了(主要是)背景任务和资源密集型任务的准备(因此,你不会阻挡国际调查的线索)。 a. 建立一个新的通道,使用以下手段:

new Thread(new Runnable(){
    public void run(){
       //do stuff here.
       }
    }
).start();

您还可以研究一下AthyncTask,以避免直接使用Threads。

根据你正在从事或正在从事的那类工作,适当利用这些顾问对于建立快速和反应灵敏的金融情报中心至关重要。

Key Rule:
If you need to to anything that accesses the filesystem, network, image loading, or anything that requires more than simple value or state checks, immediately launch and perform that effort in a thread. As already stated here, a number of options are available, although myself I usually use:

change_UI_if_needed_to_indicate_click_response();
new Thread(new Runnable(){ 
    do stuff here ; 
}).start() 

你们也可以使用标准(非在线)的物体。

这可能是坏事,我不知道。 不管怎么说,它对我来说都是好事,确实是你的问题。

www.un.org/spanish/ecosoc 如果你想利用标准的Java,而不是专门允许这种事情的专用物品,那么,每种观点都附有一种(可声明的)员额方法。 对我来说,这最容易地使我重新登上了国祥之地。

myView.post(new Runnable{
   codeForUI();
});

我的一般规则是,从来不把任何东西推到不需要的国库。 希望会有所帮助。

You must use thread, if you want to prevent application from the current error or crash "Application not responding". i use it when i call web services, geolocations.

良好的条款:

rel=“nofollow”http://souissihaythem.blogspot.com/08/application-not-responding.html

rel=“nofollow” http://souissihaythem.blogspot.com/201108/application-not-responding-solution.html





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签