Firebase でのこの更新の後、実際の問題が発生しました n 私はこのことで立ち往生しています
keyFire = this.getRef(position).getKey();
このgetKey()
メソッドは、それを使用して動作しなくなったため、エラーが発生しました..
Cannot resolve method 'getKey()'
コードは次のとおりです。
FirebaseRecyclerAdapter<Boolean, FriendsViewHolder> adapter = new FirebaseRecyclerAdapter<Boolean, FriendsViewHolder>(
Boolean.class, R.layout.chat_view_list, FriendsViewHolder.class, friendsRef){
protected void populateViewHolder(final FriendsViewHolder viewHolder, Boolean model, final int position) {
--> --> keyFire = this.getRef(position).getKey();
keyhold=keyFire;
final DatabaseReference mFirebaseRef= FirebaseDatabase.getInstance().getReferenceFromUrl(constants.FIREBASE_URL+"rootssahaj/authGplus");
mFirebaseRef.child(keyFire).addListenerForSingleValueEvent(new ValueEventListener() {
public void onDataChange(DataSnapshot dataSnapshot) {
String name = dataSnapshot.child("userNAME").getValue(String.class);
String picurl = dataSnapshot.child("picurl").getValue(String.class);
String status = dataSnapshot.child("status").getValue(String.class);
Log.e("SahajLOG", "DATASNApshot " +dataSnapshot+ " name " +name);
if(name==null){
dialogLayout.setVisibility(View.VISIBLE);
}
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Mcontext);
prefs.edit().putString("OtherUserNames"+position,name).commit();
Log.e("SahajLOG", "POSITION " +position+" " +dataSnapshot.getKey());
prefs.edit().putString("OtherEmail"+position , dataSnapshot.getKey()).commit();
prefs.edit().putString("UserEmail",EmailPref).commit();
viewHolder.mName.setText(name);
viewHolder.mStatus.setText(status);
Picasso.with(context).load(picurl).transform(new CircleTransform()).into(viewHolder.mImageProfile);
}
public void onCancelled(DatabaseError firebaseError) { }
});
}
};