0
我使用以下代碼在按鈕操作上設置線程。Android線程處理程序問題
public void onCreate(Bundle savedInstanceState) {
.........................
..........................
btnUpdateNow.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
Thread updateThread = new Thread() {
Handler uiHandle;
@Override
public void run() {
GetDetailsUpdate getDetailsUpdate = new GetDetailsUpdate(
strUserId, strPassword,
strUDID,
getApplicationContext());
uiHandle.sendEmptyMessage(0);
}
};
updateThread.start();
Handler uiHandler = new Handler(){
@Override
public void handleMessage (Message msg){
loader.setVisibility(View.INVISIBLE);
}
};
}
}
}
但它是給出以下錯誤。
05-27 17:35:11.580: ERROR/AndroidRuntime(4555): Uncaught handler: thread Thread-11 exiting due to uncaught exception
05-27 17:35:11.580: ERROR/AndroidRuntime(4555): java.lang.NullPointerException
我的代碼有什麼問題?