如何在doInBackground方法中使用runnable Thread显示AlertDialog,我使用AsyncTask,我需要使用正在运行的线程来显示我从API收到的消息,但对话框没有显示
regions <- c('Midwest','Northeast','South','West')
incomes <- c('1','2','3','4')
gender <- c('Male','Female')
age <- c('1','2','3','4','5')
data <- data.frame(stringsAsFactors = FALSE)
for(i in 1:100){
z <- data.frame(sample(gender,1),sample(age,1),sample(incomes,1),sample(regions,1))
data <- rbind(data, z)
}
colnames(data) <- c("Gender","Age","Income","Region")
data
答案 0 :(得分:0)
尝试使用处理程序:
Handler mHandler = new Handler();
mHandler.post(new Runnable() {
@Override
public void run() {
// Stuff to be shown in the UI
}
});