如何在给定条件下使用UID

时间:2018-02-06 14:59:20

标签: java android firebase-realtime-database

这是数据库中的mAuth用户的UID

app.use('/', express.static(path.join(__dirname, '../../dist')))

这是我想调用UID的条件

{
  private void startPosting() {
        mDatabaseUser1 = FirebaseDatabase.getInstance().getReference().child("users").child(mCurrentUser.getUid());


    final String desc_val = mPostDesc.getText().toString().trim();

    if (!TextUtils.isEmpty(desc_val)) {
        final DatabaseReference newPost = mDatabase1.push();


        mDatabaseUser1.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot) {


                newPost.child("desc").setValue(desc_val);
                newPost.child("uid").setValue(mCurrentUser.getUid());
                newPost.child("userimage").setValue(dataSnapshot.child("image").getValue());
                newPost.child("username").setValue(dataSnapshot.child("name").getValue()).addOnCompleteListener(new OnCompleteListener<Void>() {
                    @Override
                    public void onComplete(@NonNull Task<Void> task) {

                        if (task.isSuccessful()) {

                            mPostDesc.getText().clear();
                            mBlogList.setLayoutManager(new LinearLayoutManager(getApplicationContext()));

                            LinearLayoutManager mlinearLayoutManager = new LinearLayoutManager(getApplicationContext());



                            mBlogList.setLayoutManager(mlinearLayoutManager);



                            mlinearLayoutManager.setStackFromEnd(true);


                        }


                    }
                });

            }

            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
        });
    }
} 
}  

0 个答案:

没有答案