我有一些奇怪的问题:
我在我的布局中添加了MediaRouteButton
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/group_right"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/right_btns"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:minWidth="@dimen/actionbar_icon_width"
android:orientation="horizontal" >
</LinearLayout>
<android.support.v7.app.MediaRouteButton
android:id="@+id/media_route_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
它在我的新设备上工作得非常好.但对于3.1,3.3或更低版本的旧设备,我遇到了这个例外
Caused by: android.view.InflateException: Binary XML file line #74: Error inflating class android.support.v7.app.MediaRouteButton
at android.view.LayoutInflater.createView(LayoutInflater.java:596)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:671)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:724)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:727)
at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
at android.view.LayoutInflater.inflate(LayoutInflater.java:391)
at android.view.LayoutInflater.inflate(LayoutInflater.java:347)
at de.myapp.views.MyActionBar.<init>(MyActionBar.java:54)
... 36 more
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:416)
at android.view.LayoutInflater.createView(LayoutInflater.java:576)
... 43 more
Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f01000c …Run Code Online (Sandbox Code Playgroud) 我目前正在使用Firebase.目前我正在使用com.google.firebase:firebase-auth:10.0.1
创建用户,登录就像魅力一样.
现在我想为用户添加一个选项,用户可以在其中更改他/她的displayName和profileImage
在Activity AI中,通过单击按钮调用此方法:
public void updateFirebaseUser(String newDisplayName, Uri newPhotoUri) {
final FirebaseAuth auth = FirebaseAuth.getInstance();
final FirebaseUser user = auth.getCurrentUser();
if (user == null || (TextUtils.isEmpty(newDisplayName) && newPhotoUri == null)) {
return;
}
UserProfileChangeRequest.Builder builder = new UserProfileChangeRequest.Builder();
if (!TextUtils.isEmpty(newDisplayName)) {
builder.setDisplayName(newDisplayName);
}
if (newPhotoUri != null) {
builder.setPhotoUri(newPhotoUri);
}
UserProfileChangeRequest request = builder.build();
user.updateProfile(request)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
Toast.makeText(context, "profile update success = " + task.isSuccessful(),
Toast.LENGTH_SHORT)
.show();
}
}); …Run Code Online (Sandbox Code Playgroud)