现在做的这个程序,主要就是实现解析webservice地址(解析方法:initPfInventory();),然后连接。
我现在想做的就是如果地址解析不出来就一直执行while (!isget).....直到解析出来为止。但是我把while直接写到onCreat中程序就一直死在while里,解析不出值。我如果把while写到threadGetParm.start();线程中去调用程序就正常。所以我不明白为什么不能直接在onCreat中写这个判断方法呢?希望得到大家的帮助。public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.menu);
Boolean isget = false;
while (!isget)
{
try {
Thread.sleep(100);
isget = initPfInventory();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
};
......public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.menu);
threadGetParm.start();......