在Android的线程中调用 [英] Thread Calling in Android

查看:118
本文介绍了在Android的线程中调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的工作在Android应用程序,我需要在哪些线程是Java的一个众所周知的概念工作。我有一个名为在我的应用THRD线程,我想它调用了IF ... ELSE循环的其他部分。

I am working on an Android Application where I need to work on thread which is a well known concept of Java. I am having a thread named "thrd" in my application and I want to call it in the else part of the IF...Else loop.

谁能告诉我怎样才能调用线程在我的循环,对不起,我是全新的,只要使用Java或Android关注的工作。

Can anyone please tell me how can I call that thread in my loop, Sorry I am totally new as far as working with Java or Android is concerned.

感谢提前的帮助下,
大卫

Thanks for the help in Advance, david

推荐答案

线程只是Java对象,所以你需要要启动线程的线程参考。我认为这是不可能的(或者不是一个好主意,如果可能的话)来获得这样的提法形成一个线程名。这里是开始使用线程code样品:<​​/ P>

Threads are just Java object, so you need a thread reference on the thread you want to start. I think it's impossible (or not a good idea if possible) to get such a reference form a thread name. Here is code sample to get started with threads:

// This class extends Thread class 
BasicThread1 extends Thread { 
     // This method is called when the thread runs 
      public void run() { 
        // Your code here
      } 
} 

// Create and start the thread 
Thread thread = new BasicThread1(); 
thread.start(); 

这篇关于在Android的线程中调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆