尝试将Facebook个人资料图片发送到ImageView

时间:2017-08-02 03:12:28

标签: android facebook-graph-api firebase firebase-authentication

我正在使用Firebase Facebook身份验证并尝试将个人资料图片提取到菜单ImageView尝试了所有内容,但它说了同样的事情。

这是HomeScreen.java中的代码,其中包含菜单,如果您需要其他代码,我的登录位于MainScreen.java中,请告诉我。

public class HomeScreen extends AppCompatActivity {

private DrawerLayout mDrawerLayout;
private ActionBarDrawerToggle mToggle;
private Toolbar mToolbar;
private CircleImageView mProfile;

@Override
protected void onCreate(Bundle savedInstanceState) {
    setTheme(R.style.MyNavTheme);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_home_screen);

    mToolbar = (Toolbar) findViewById(R.id.nav_actionbar);
    setSupportActionBar(mToolbar);


    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout);
    mToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.string.opendrawer, R.string.closedrawer);

    mDrawerLayout.addDrawerListener(mToggle);
    mToggle.syncState();

    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    /**-------------------Facebook Profile Picture-----------------------*/
   mProfile = (CircleImageView) findViewById(R.id.ivProfile);
   int dimensionPixelSize = getResources().getDimensionPixelSize(com.facebook.R.dimen.com_facebook_profilepictureview_preset_size_large);
   Uri profilePictureUri= Profile.getCurrentProfile().getProfilePictureUri(dimensionPixelSize , dimensionPixelSize);
   Glide.with(this).load(profilePictureUri)
           .diskCacheStrategy(DiskCacheStrategy.SOURCE)
           .into(mProfile);

}

ImageView我试图把它放进去

<de.hdodenhof.circleimageview.CircleImageView
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/ivProfile"
    android:layout_width="110dp"
    android:layout_height="110dp"
    android:layout_marginLeft="10dp"
    android:layout_marginTop="10dp"
    app:civ_border_width="2dp"
    app:civ_border_color="#FFFFFF"/>

错误:

08-02 11:04:46.791 22863-22863/com.shopfolio.shopfolio E/AndroidRuntime: FATAL EXCEPTION: main
                                                                         Process: com.shopfolio.shopfolio, PID: 22863
                                                                         java.lang.RuntimeException: Unable to start activity ComponentInfo{com.shopfolio.shopfolio/com.shopfolio.shopfolio.HomeScreen}: java.lang.IllegalArgumentException: You must pass in a non null View
                                                                             at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
                                                                             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
                                                                             at android.app.ActivityThread.-wrap11(Unknown Source:0)
                                                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
                                                                             at android.os.Handler.dispatchMessage(Handler.java:105)
                                                                             at android.os.Looper.loop(Looper.java:164)
                                                                             at android.app.ActivityThread.main(ActivityThread.java:6540)
                                                                             at java.lang.reflect.Method.invoke(Native Method)
                                                                             at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
                                                                          Caused by: java.lang.IllegalArgumentException: You must pass in a non null View
                                                                             at com.bumptech.glide.GenericRequestBuilder.into(GenericRequestBuilder.java:678)
                                                                             at com.bumptech.glide.DrawableRequestBuilder.into(DrawableRequestBuilder.java:448)
                                                                             at com.shopfolio.shopfolio.HomeScreen.onCreate(HomeScreen.java:56)
                                                                             at android.app.Activity.performCreate(Activity.java:6980)
                                                                             at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
                                                                             at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
                                                                             at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
                                                                             at android.app.ActivityThread.-wrap11(Unknown Source:0) 
                                                                             at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
                                                                             at android.os.Handler.dispatchMessage(Handler.java:105) 
                                                                             at android.os.Looper.loop(Looper.java:164) 
                                                                             at android.app.ActivityThread.main(ActivityThread.java:6540) 
                                                                             at java.lang.reflect.Method.invoke(Native Method) 
                                                                             at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
                                                                             at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 
08-02 11:04:46.791 22863-22863/com.shopfolio.shopfolio E/UncaughtException: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.shopfolio.shopfolio/com.shopfolio.shopfolio.HomeScreen}: java.lang.IllegalArgumentException: You must pass in a non null View
                                                                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
                                                                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
                                                                                at android.app.ActivityThread.-wrap11(Unknown Source:0)
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
                                                                                at android.os.Handler.dispatchMessage(Handler.java:105)
                                                                                at android.os.Looper.loop(Looper.java:164)
                                                                                at android.app.ActivityThread.main(ActivityThread.java:6540)
                                                                                at java.lang.reflect.Method.invoke(Native Method)
                                                                                at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
                                                                             Caused by: java.lang.IllegalArgumentException: You must pass in a non null View
                                                                                at com.bumptech.glide.GenericRequestBuilder.into(GenericRequestBuilder.java:678)
                                                                                at com.bumptech.glide.DrawableRequestBuilder.into(DrawableRequestBuilder.java:448)
                                                                                at com.shopfolio.shopfolio.HomeScreen.onCreate(HomeScreen.java:56)
                                                                                at android.app.Activity.performCreate(Activity.java:6980)
                                                                                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
                                                                                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
                                                                                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892) 
                                                                                at android.app.ActivityThread.-wrap11(Unknown Source:0) 
                                                                                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593) 
                                                                                at android.os.Handler.dispatchMessage(Handler.java:105) 
                                                                                at android.os.Looper.loop(Looper.java:164) 
                                                                                at android.app.ActivityThread.main(ActivityThread.java:6540) 
                                                                                at java.lang.reflect.Method.invoke(Native Method) 
                                                                                at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) 
                                                                                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) 

抱歉,如果不够清楚

0 个答案:

没有答案