来自Firebase的图像显示在模拟器中,但没有出现在手机中
我的应用程序有一个导航标头显示用户的照片以及一个显示一个活动的活动 输出在我的笔记本电脑仿真器上正确显示,但是当我在设备上运行该应用程序时没有显示任何错误(请检查烤面包,以防获取信息为无触发的信息),
我还尝试调整该图像以适合图像图像视图使用Glide,将图像保存在Firebase存储中,并给出了一个URI,该URI保存在用户的树中,然后将其访问并将其称为模拟器上,但不在手持设备中,我尝试在移动数据上运行的其他方式,以防其路由器问题,而不同的设备请帮助< use-permission android:name =“
android.permission.access_network_state显示活动
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_id);
pfp=findViewById(R.id.picture);
fnameofstd=findViewById(R.id.idname);
numofstd=findViewById(R.id.idcon);
classofstd=findViewById(R.id.idclass);
lnameofstd=findViewById(R.id.idLname);
user=FirebaseAuth.getInstance().getCurrentUser();
reference= FirebaseDatabase.getInstance().getReference("users");
userID=user.getUid();
//takes val from database and feeds to places
reference.child(userID).addValueEventListener(new ValueEventListener()
{
@Override
public void onDataChange(@NonNull DataSnapshot snapshot)
{
RegisterUser reguser=snapshot.getValue(RegisterUser.class);
if (reguser!=null)
{
String FNAME= reguser.fname;
String LNAME= reguser.lname;
String NUMBER= reguser.phnumner;
String SUBJECT= reguser.stream;
fnameofstd.setText("First Name:- "+FNAME);
lnameofstd.setText("Last Name:- "+LNAME);
numofstd.setText("Mobile Number:- "+NUMBER);
classofstd.setText("Stream:- "+SUBJECT);
Glide.with(getApplicationContext()).load(reguser.getpfp()).centerCrop().into(pfp);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
Toast.makeText(IDActivity.this, "error", Toast.LENGTH_SHORT).show();
}
});
}
}
My app has a nav header which displays the photo of user as well as a activity that shows one
the output is shown properly on my laptop Emulator but does not show up when I run the app on a device no errors (checked to send a toast in case the info fetched is null did not trigger)
I also tried resizing the image to fit the image view using glide, the image is being saved in firebase storage and is given a URI which is saved in user's tree which is then accessed and called this all works on emulator but does not in a hand held device and I tried the other ways of running on Mobile Data in case its a router issue and different devices kindly help <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
code for the photo showing activity
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_id);
pfp=findViewById(R.id.picture);
fnameofstd=findViewById(R.id.idname);
numofstd=findViewById(R.id.idcon);
classofstd=findViewById(R.id.idclass);
lnameofstd=findViewById(R.id.idLname);
user=FirebaseAuth.getInstance().getCurrentUser();
reference= FirebaseDatabase.getInstance().getReference("users");
userID=user.getUid();
//takes val from database and feeds to places
reference.child(userID).addValueEventListener(new ValueEventListener()
{
@Override
public void onDataChange(@NonNull DataSnapshot snapshot)
{
RegisterUser reguser=snapshot.getValue(RegisterUser.class);
if (reguser!=null)
{
String FNAME= reguser.fname;
String LNAME= reguser.lname;
String NUMBER= reguser.phnumner;
String SUBJECT= reguser.stream;
fnameofstd.setText("First Name:- "+FNAME);
lnameofstd.setText("Last Name:- "+LNAME);
numofstd.setText("Mobile Number:- "+NUMBER);
classofstd.setText("Stream:- "+SUBJECT);
Glide.with(getApplicationContext()).load(reguser.getpfp()).centerCrop().into(pfp);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
Toast.makeText(IDActivity.this, "error", Toast.LENGTH_SHORT).show();
}
});
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论