当我像下一个把值推到它时,我想要检索firebase生成的id
我想检索"-KGdKiPSODz7JXzlgl9J"这个id我为getKey()尝试的那个电子邮件,但它返回"用户",当用户获取值时,它将整个对象从id返回到个人资料图片,这不会让我得到它作为我的应用中的用户对象
怎么解决这个?
Firebase users = myFirebaseRef.child("users");
users.orderByChild("email").equalTo("z@m.com").addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
dataSnapshot.getKey();
Log.d("User",dataSnapshot.getRef().toString());
Log.d("User",dataSnapshot.getValue().toString());
}
@Override
public void onCancelled(FirebaseError firebaseError) {
Log.d("User",firebaseError.getMessage() );
}
});
Run Code Online (Sandbox Code Playgroud) 在Glide 4.3的新版本中,我试图使用它,但每当我使用它时,它都会崩溃,无论我传递给它的上下文.
这是向我显示的错误
java.lang.AbstractMethodError: abstract method "void com.bumptech.glide.module.RegistersComponents.registerComponents(android.content.Context, com.bumptech.glide.Glide, com.bumptech.glide.Registry)"
Run Code Online (Sandbox Code Playgroud)
这是我试过的代码:
Glide.with(getApplicationContext()).
load(url)
.into(imageView);
Run Code Online (Sandbox Code Playgroud)
和
Glide.with(getContext()).
load(url)
.into(imageView);
Run Code Online (Sandbox Code Playgroud)
它给了我那个警告
W/Glide: Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored
Run Code Online (Sandbox Code Playgroud)
和gradle中的lib代码
compile 'com.github.bumptech.glide:glide:4.3.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.3.1'
Run Code Online (Sandbox Code Playgroud)
Update1:Waring Solved By添加扩展AppGlideModule的类
import com.bumptech.glide.annotation.GlideModule;
import com.bumptech.glide.module.AppGlideModule;
@GlideModule
public final class MyAppGlideModule extends AppGlideModule {}
Run Code Online (Sandbox Code Playgroud)
但同样的错误仍然存在
我在Firebase云消息传递中遇到问题,因为我仅在Firebase中使用过它,直到现在当我从Firebase的Notification压缩器发送通知时,都无法正常工作
我的build.gradle(项目)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
我的build.gradle(App)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
android {
compileSdkVersion 28
buildToolsVersion "28.0.3" …Run Code Online (Sandbox Code Playgroud) notifications android push-notification firebase firebase-cloud-messaging
我正在尝试更新我的android工作室为最新版本稳定最近发布的2.2稳定从我当前的版本2.1.3在Ubuntu这显示上面的android工作室
完成之后它就关闭了android工作室,当再打开它时没有改变它仍然版本2.1.3
它发生了两次?如何解决这个问题,因为这是Ubuntu第一次更新?
我希望make成为全屏,并且适用于所有智能手机,这个代码部分创建了一个水平和垂直滚动的tablelayout,我也希望查看以布局为中心的edittext矩阵.谢谢
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.seconda);
HorizontalScrollView HSC = new HorizontalScrollView(this);
ScrollView VSC = new ScrollView(this);
VSC.setBackgroundResource(R.drawable.lavagna_psd);
tableLayout = new TableLayout(this);
tableLayout.setGravity(Gravity.CENTER);
values = new EditText[3][3];
for (int i = 0; i < 3; i++) {
tableRow = new TableRow(this);
tableRow.setGravity(Gravity.CENTER);
for (int j = 0; j < 3 ; j++) {
values[i][j] = new EditText(this);
values[i][j].setHint("r: " + (i) + " " + "c: " + (j));
values[i][j].setPadding(10, 10, 10, 10);
tableRow.addView(values[i][j]);
}
tableLayout.addView(tableRow); …Run Code Online (Sandbox Code Playgroud) 这是我的问题,同时进行如下所示的评论的新recyclerview,如下图所示
我的活动
public class ReviewsActivity extends AppCompatActivity {
private ArrayList<Review> reviews;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_reviews);
reviews = new Gson().fromJson(getIntent().getStringExtra("reviews"), new
TypeToken<List<Review>>() {
}.getType());
setUpReviewsList();
}
void setUpReviewsList() {
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rvReviews);
ReviewsRvAdapter mAdapter = new ReviewsRvAdapter(this, reviews, true);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(mAdapter);
}
}
Run Code Online (Sandbox Code Playgroud)
我的适配器
public class ReviewsRvAdapter extends RecyclerView.Adapter<ReviewsRvHolder>
{
private ArrayList<Review> reviews;
private Context context;
ReviewsRvHolder holder;
private DatabaseReference mDatabase;
boolean isActivity = false;
// Provide a suitable constructor (depends on the kind …Run Code Online (Sandbox Code Playgroud)