与Facebook在Android的工作。有时候我申请兑现实时设备时,我试图授权的Facebook在Android.not的模拟器。我用了Android的Facebook SDK。所以我想线程可能会停止that.First试过的AsyncTask
Working with facebook in Android. Sometimes my application is cashing in real time device when I tried to authorize Facebook in Android.not in emulator. I used the Android Facebook SDK. So I thought threading might stop that.First tried the asynctask
Activity act=this;
private class fbwork extends AsyncTask<Facebook, Integer, String>
{
@Override
protected String doInBackground(Facebook... para)
{
// TODO Auto-generated method stub
Log.d(tagg, "Entered async");
if(loginflag==0)
{
try
{
para[0].authorize(act, PERMISSIONS, new LoginDialogListener());
}catch(Exception ex)
{
Log.d(tagg,ex.getMessage());
}
Log.d(tagg, tagg.toString());
}
else
{
try {
logout();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return "0";
}
调用code:
calling code:
new fbwork().execute(facebook);
产生错误:内螺纹尚未调用无法建立处理活套prepare()
于是尝试了正常的穿线方法。
So tried the normal threading way.
public void loginprocesure() throws MalformedURLException, IOException
{
final Activity ac=this;
if(loginflag==0)
{
new Thread(new Runnable() {
public void run() {
// TODO Auto-generated method stub
facebook.authorize(ac, PERMISSIONS, new LoginDialogListener());
}
}).start();
}
else
{
logout();
}
}
再次相同的结果。什么办法来解决这个问题!!!!如何停止在实际设备应用程序的崩溃。请大家帮帮忙。
我面临同样的issue.You必须尝试把这个方法在环
I faced the same issue.You must try to put this method in loop
Looper.prepare();
new fbwork().execute(facebook);
Looper.loop();