gpt4 book ai didi

java - 执行 doInBackground() 时发生错误,同时执行 facebook like

转载 作者:行者123 更新时间:2023-11-30 02:51:14 25 4
gpt4 key购买 nike

我有这样的代码:

private void fbLike_optionA() {

Bundle params1 = new Bundle();
params1.putString("object", "http://samples.ogp.me/226075010839791");
/* make the API call */
new Request(Session.getActiveSession(), "/me/og.likes", params1,
HttpMethod.POST, new Request.Callback() {
public void onCompleted(Response response) {
/* handle the result */

String a = "1";
}
}).executeAsync();
}

错误是因为假的(?) url 吗?

“http://samples.ogp.me/226075010839791”

我 tun 并得到这个错误:

06-09 12:36:58.791: E/AndroidRuntime(1030): FATAL EXCEPTION: AsyncTask #5
06-09 12:36:58.791: E/AndroidRuntime(1030): java.lang.RuntimeException: An error occured while executing doInBackground()
06-09 12:36:58.791: E/AndroidRuntime(1030): at android.os.AsyncTask$3.done(AsyncTask.java:299)
06-09 12:36:58.791: E/AndroidRuntime(1030): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
06-09 12:36:58.791: E/AndroidRuntime(1030): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
06-09 12:36:58.791: E/AndroidRuntime(1030): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
06-09 12:36:58.791: E/AndroidRuntime(1030): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
06-09 12:36:58.791: E/AndroidRuntime(1030): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-09 12:36:58.791: E/AndroidRuntime(1030): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-09 12:36:58.791: E/AndroidRuntime(1030): at java.lang.Thread.run(Thread.java:841)
06-09 12:36:58.791: E/AndroidRuntime(1030): Caused by: java.lang.IllegalStateException: Cannot execute task: the task is already running.
06-09 12:36:58.791: E/AndroidRuntime(1030): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:575)
06-09 12:36:58.791: E/AndroidRuntime(1030): at android.os.AsyncTask.execute(AsyncTask.java:534)
06-09 12:36:58.791: E/AndroidRuntime(1030): at com.facebook.RequestAsyncTask.executeOnSettingsExecutor(RequestAsyncTask.java:186)
06-09 12:36:58.791: E/AndroidRuntime(1030): at com.facebook.Request.executeBatchAsync(Request.java:1838)
06-09 12:36:58.791: E/AndroidRuntime(1030): at com.facebook.Request.executeBatchAsync(Request.java:1813)
06-09 12:36:58.791: E/AndroidRuntime(1030): at com.facebook.Request.executeBatchAsync(Request.java:1790)
06-09 12:36:58.791: E/AndroidRuntime(1030): at com.facebook.Request.executeAsync(Request.java:1562)
06-09 12:36:58.791: E/AndroidRuntime(1030): at com.zoomer.general.ImageAdapter.fbLike_optionA(ImageAdapter.java:508)
06-09 12:36:58.791: E/AndroidRuntime(1030): at com.zoomer.general.ImageAdapter.access$0(ImageAdapter.java:479)
06-09 12:36:58.791: E/AndroidRuntime(1030): at com.zoomer.general.ImageAdapter$LikeFbPostAsyncTask.doInBackground(ImageAdapter.java:735)
06-09 12:36:58.791: E/AndroidRuntime(1030): at com.zoomer.general.ImageAdapter$LikeFbPostAsyncTask.doInBackground(ImageAdapter.java:1)
06-09 12:36:58.791: E/AndroidRuntime(1030): at android.os.AsyncTask$2.call(AsyncTask.java:287)
06-09 12:36:58.791: E/AndroidRuntime(1030): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
06-09 12:36:58.791: E/AndroidRuntime(1030): ... 4 more
06-09 12:36:59.106: E/WindowManager(1030): Activity com.zoomer.offers.OffersListActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{427e3368 V.E..... R....... 0,0-640,1230} that was originally added here
06-09 12:36:59.106: E/WindowManager(1030): android.view.WindowLeaked: Activity com.zoomer.offers.OffersListActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{427e3368 V.E..... R....... 0,0-640,1230} that was originally added here
06-09 12:36:59.106: E/WindowManager(1030): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:454)
06-09 12:36:59.106: E/WindowManager(1030): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:258)
06-09 12:36:59.106: E/WindowManager(1030): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:73)
06-09 12:36:59.106: E/WindowManager(1030): at android.app.Dialog.show(Dialog.java:287)
06-09 12:36:59.106: E/WindowManager(1030): at com.zoomer.general.ImageAdapter$4.onClick(ImageAdapter.java:311)
06-09 12:36:59.106: E/WindowManager(1030): at android.view.View.performClick(View.java:4475)
06-09 12:36:59.106: E/WindowManager(1030): at android.view.View$PerformClick.run(View.java:18786)
06-09 12:36:59.106: E/WindowManager(1030): at android.os.Handler.handleCallback(Handler.java:730)
06-09 12:36:59.106: E/WindowManager(1030): at android.os.Handler.dispatchMessage(Handler.java:92)
06-09 12:36:59.106: E/WindowManager(1030): at android.os.Looper.loop(Looper.java:137)
06-09 12:36:59.106: E/WindowManager(1030): at android.app.ActivityThread.main(ActivityThread.java:5493)
06-09 12:36:59.106: E/WindowManager(1030): at java.lang.reflect.Method.invokeNative(Native Method)
06-09 12:36:59.106: E/WindowManager(1030): at java.lang.reflect.Method.invoke(Method.java:525)
06-09 12:36:59.106: E/WindowManager(1030): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1209)
06-09 12:36:59.106: E/WindowManager(1030): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1025)
06-09 12:36:59.106: E/WindowManager(1030): at dalvik.system.NativeStart.main(Native Method)

最佳答案

我建议你使用这个库(details here):

dependencies {
compile 'com.shamanland:facebook-like-button:0.1.8'
}

此库使用 WebView 实现“喜欢”操作和 <iframe>基于facebook plugin .

看截图:

enter image description here enter image description here

关于java - 执行 doInBackground() 时发生错误,同时执行 facebook like,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24117458/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com