如何将当前用户登录的uid从适配器传递到其他activity我已经将点击的项目id从适配器传递到其他activity,这很容易,因为我已经打印了这个id,但我不知道如何传递当前用户登录的uid,请指导
//I have retrieve data in main activity of current user
private void loadmyinfo() {
DatabaseReference ref= FirebaseDatabase.getInstance().getReference("Users");
ref .orderByChild("uid").equalTo(firebaseAuth.getUid()).addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
for(DataSnapshot ds:snapshot.getChildren())
{
String Nam=""+ds.child("name").getValue();
// String accounttype=""+ds.child("account type").getValue();
String Profile=""+ds.child("profileuser").getValue();
String Email=""+ds.child("email").getValue();
String cphone=""+ds.child("phone").getValue();
nametx.setText(Nam);
cphon.setText(cphone);
nameemail.setText(Email);
try {
/* Glide.with(ProfileeditsellerActivity.this)
.load(Profile)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true)
.into(profile);*/
Picasso.get().load(Profile).placeholder(R.drawable.ic_profile_gray).into(profile);
}
catch (Exception e){
profile.setImageResource(R.drawable.ic_profile_gray);
}
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
适配器类
//In adapter class I have passed the id of clicked item but I want also to pass uid of current user
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
/* Intent intent=new Intent(context,BilActivity.class);
intent.putExtra("id",id);
context.startActivity(intent);*/
Intent intent=new Intent(holder.itemView.getContext(),PayfeeActivity.class);
intent.putExtra("id",id);
holder.itemView.getContext().startActivity(intent);
}
});
您可以从应用程序中的任何地方获取当前登录的firebase用户
FirebaseAuth.getInstance().getCurrentUser().getUid();
我想把它从适配器传递到这个,这是我的适配器 这是我的适配器,它保存着RecycerView,我正在尝试获取考勤活动上查看的用户id RecycerView
问题内容: 我需要Selenium才能完成javascript工作。 首先,我使用Scrapy登录,然后需要使用Selenium 打开。 问题在于Selenium没有cookie,因此它打开了登录页面。 有谁知道我该如何从曲奇到selenium传递曲奇? 问题答案: 由于您到目前为止还没有提供您编写的任何代码,因此我仅介绍您。 为了从Scrapy获取cookie,请查看和方法 为了设置硒驱动程序的
特别是,当我使用这些行获取错误时: 我尝试了下面的代码: 并且获取常数大于0,并且显示Cart中的项数为1,但是每当我在代码获取问题中使用这一行时,从适配器到活动获取值是正确的方法吗? cartAdapter.java: logcat:
问题内容: 该文档讨论了使用numba的作为的参数。我需要带有附加参数的相同内容。 我基本上是想做这样的事情: 但是,它不起作用,因为应该是/并且不能将它们转换为。我收到以下错误消息: 我没有找到有关如何从Numba中提取值的任何信息。在C语言中,应该类似于—在Numba中可以做同样的事情吗? 问题答案: 1.通过传递额外的参数 该文件说: 如果用户希望改善集成性能,则可以使用以下签名之一: 该是
我正在尝试将当前登录的用户插入到侦听器中。我的目标是每次用户执行任何操作时(这两种方法都不适用于我),都将current\DateTime()写入“demo\u user”表的“last\u active”列。 app/config/config.yml src/Demo/UserBundle/EventListener/ActivityWatcher.php 但是$代币总是空的...更新:没有提