问题描述
嘿我每次使用这段代码来获取Facebook的个人资料,但它不适合我......我正在按照这个教程http://www.androidhive.info/2012/03/android-facebook-connect-教程/我不知道这是什么问题请帮帮我。
public void getProfileInformation(){
mAsyncRunner.request( me,new RequestListener(){
@Override
public void onComplete(String response,Object state){
Log.d(Profile,response);
String json = response;
try {
txt2.setText(testing 124);
JSONObject profile = new JSONObject(json);
//获取名称用户
final String name = profile.getString(name);
//获取用户的电子邮件
final String email = p rofile.getString( 电子邮件);
txt2.setText(姓名:+姓名+电子邮件:+电子邮件);
runOnUiThread(new Runnable(){
@Override
public void run(){
Toast.makeText(getApplicationContext(),Name:+ name + \ nEmail:+ email,Toast.LENGTH_LONG)。show();
}
});
} catch(JSONException e){
txt2.setText(e.toString());
e.printStackTrace();
}
logoutFromFacebook();
}
@Override
public void onIOException(IOException e,Object state){
}
@Override
public void onFileNotFoundException(FileNotFoundException e,
Object state){
}
@Override
public void onMalformedURLException(MalformedURLException e,
Object state){
}
@Override
public void onFacebookError(FacebookError e,Object state){
}
});
}
请帮帮我怎么办..
这些错误:
< pre>
06-19 06:35:07.180:E / chromium(1759):[错误: gl_surface_egl.cc(153)]找不到合适的EGL配置。
06-19 06:35:07.180:E / chromium(1759):[错误:gl_surface_egl.cc(620)] GLSurfaceEGL :: InitializeOneOff失败。
06-19 06:35:07.200:E / chromium(1759):[错误:gl_surface_egl.cc(153)]找不到合适的EGL配置。
06-19 06:35:07.200:E / chromium(1759):[错误:gl_surface_egl.cc(620)] GLSurfaceEGL :: InitializeOneOff失败。
06-19 06:35:07.230: E / chromium(1759):[错误:gpu_info_collector.cc(86)] gfx :: GLSurface :: InitializeOneOff()失败
06-19 06:35:12.470:E / chromium(1759) :[错误:simple_backend_impl.cc(186)]文件结构与磁盘缓存后端不匹配。
06-19 06:35:12.470:E / chromium(1759):[错误:simple_backend_impl。 cc(402)]简单缓存后端:磁盘上的文件结构错误: /data/data/com.facebook.androidhive/app_webview/Cache
06-19 06:36:38.000:E / chromium(1893):[错误:gl_surface_egl.cc(153)]不合适发现EGL配置。
06-19 06:36:38.000:E / chromium(1893):[错误:gl_surface_egl.cc(620)] GLSurfaceEGL :: InitializeOneOff失败。
06-19 06:36:38.010:E / chromium(1893):[错误:gl_surface_egl.cc(153)]找不到合适的EGL配置。
06-19 06:36:38.010 :E / chromium(1893):[错误:gl_surface_egl.cc(620)] GLSurfaceEGL :: InitializeOneOff失败。
06-19 06:36:38.010:E / chromium(1893):[ERROR :gpu_info_collector.cc(86)] gfx :: GLSurface :: InitializeOneOff()失败
06-19 07:36:10.530:E / AndroidRuntime(2428):致命异常:Thread-94
06-19 07:36:10.530:E / AndroidRuntime(2428):处理:com.facebook.androidhive,PID:2428
06-19 07:36:10.530: E / AndroidRuntime(2428):java.lang.RuntimeException:无法在未调用Looper.prepare()的线程内创建处理程序
06-19 07:36 :10.530:E / AndroidRuntime(2428):在android.os.Handler。< init>(Handler.java:200)
06-19 07:36:10.530:E / AndroidRuntime(2428) ):在android.os.Handler。< init>(Handler.java:114)
06-19 07:36:10.530:E / AndroidRuntime(2428):在android.widget.Toast $ TN。< init>(Toast.java:327)
06-19 07:36:10.530:E / AndroidRuntime(2428):在android.widget.Toast。< init>( Toast.java:92)
06-19 07:36:10.530:E / AndroidRuntime(2428):在android.widget.Toast.makeText(Toast.java:241)
06-19 07:36:10.530:E / AndroidRuntime(2428):at com.facebook.androidhive.AndroidFacebookConnectActivity $ 6.onComplete(AndroidFacebookConnectActivity.java:200)
06-19 07: 36:10.530:E / AndroidRuntime(2428):at com.facebook.android.AsyncFacebookRunner $ 2.run(AsyncFacebookRunner.java:254)
hey Every i am using this code to get profile from facebook but its not working for me... and i am follow this tutorial http://www.androidhive.info/2012/03/android-facebook-connect-tutorial/ i dont know what the problem is this please help me.
public void getProfileInformation() { mAsyncRunner.request("me", new RequestListener() { @Override public void onComplete(String response, Object state) { Log.d("Profile", response); String json = response; try { txt2.setText("testing 124"); JSONObject profile = new JSONObject(json); // getting name of the user final String name = profile.getString("name"); // getting email of the user final String email = profile.getString("email"); txt2.setText("Name: " +name+"Email: " +email); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getApplicationContext(), "Name: " + name + "\nEmail: " + email, Toast.LENGTH_LONG).show(); } }); } catch (JSONException e) { txt2.setText(e.toString()); e.printStackTrace(); } logoutFromFacebook(); } @Override public void onIOException(IOException e, Object state) { } @Override public void onFileNotFoundException(FileNotFoundException e, Object state) { } @Override public void onMalformedURLException(MalformedURLException e, Object state) { } @Override public void onFacebookError(FacebookError e, Object state) { } }); }
please help me what should i do..
these error:
<pre>
06-19 06:35:07.180: E/chromium(1759): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found.
06-19 06:35:07.180: E/chromium(1759): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed.
06-19 06:35:07.200: E/chromium(1759): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found.
06-19 06:35:07.200: E/chromium(1759): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed.
06-19 06:35:07.230: E/chromium(1759): [ERROR:gpu_info_collector.cc(86)] gfx::GLSurface::InitializeOneOff() failed
06-19 06:35:12.470: E/chromium(1759): [ERROR:simple_backend_impl.cc(186)] File structure does not match the disk cache backend.
06-19 06:35:12.470: E/chromium(1759): [ERROR:simple_backend_impl.cc(402)] Simple Cache Backend: wrong file structure on disk: /data/data/com.facebook.androidhive/app_webview/Cache
06-19 06:36:38.000: E/chromium(1893): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found.
06-19 06:36:38.000: E/chromium(1893): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed.
06-19 06:36:38.010: E/chromium(1893): [ERROR:gl_surface_egl.cc(153)] No suitable EGL configs found.
06-19 06:36:38.010: E/chromium(1893): [ERROR:gl_surface_egl.cc(620)] GLSurfaceEGL::InitializeOneOff failed.
06-19 06:36:38.010: E/chromium(1893): [ERROR:gpu_info_collector.cc(86)] gfx::GLSurface::InitializeOneOff() failed
06-19 07:36:10.530: E/AndroidRuntime(2428): FATAL EXCEPTION: Thread-94
06-19 07:36:10.530: E/AndroidRuntime(2428): Process: com.facebook.androidhive, PID: 2428
06-19 07:36:10.530: E/AndroidRuntime(2428): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
06-19 07:36:10.530: E/AndroidRuntime(2428): at android.os.Handler.<init>(Handler.java:200)
06-19 07:36:10.530: E/AndroidRuntime(2428): at android.os.Handler.<init>(Handler.java:114)
06-19 07:36:10.530: E/AndroidRuntime(2428): at android.widget.Toast$TN.<init>(Toast.java:327)
06-19 07:36:10.530: E/AndroidRuntime(2428): at android.widget.Toast.<init>(Toast.java:92)
06-19 07:36:10.530: E/AndroidRuntime(2428): at android.widget.Toast.makeText(Toast.java:241)
06-19 07:36:10.530: E/AndroidRuntime(2428): at com.facebook.androidhive.AndroidFacebookConnectActivity$6.onComplete(AndroidFacebookConnectActivity.java:200)
06-19 07:36:10.530: E/AndroidRuntime(2428): at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:254)
这篇关于在Android中获取Facebook个人资料的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!