В последний раз, когда я работал над своим приложением, оно работало нормально, как и ожидалось. После месяца, когда я не работал над ним, он не раскрывает макет, как показано, когда я последний раз работал над ним. Когда я нажимаю кнопку, открывается пустая страница
Адаптер
public class RestaurantAdapter extends FirebaseRecyclerAdapter<RestaurantDetails,RestaurantAdapter.RestaurantViewHolder> {
public RestaurantAdapter(@NonNull FirebaseRecyclerOptions<RestaurantDetails> options) {
super(options);
}
FirebaseRecyclerOptions<RestaurantDetails> options =
new FirebaseRecyclerOptions.Builder<RestaurantDetails>()
.setQuery(FirebaseDatabase.getInstance().getReference().child("Restaurant").child("Info"), RestaurantDetails.class)
.build();
@Override
protected void onBindViewHolder(@NonNull RestaurantViewHolder holder, final int position, @NonNull final RestaurantDetails details) {
holder.restaurant_Name.setText(details.getName());
holder.restaurant_Category.setText(details.getCategory());
holder.restaurant_Location.setText(details.getLocation());
Picasso.get().load(details.getImage()).into(holder.restaurant_Image);
holder.itemView.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View view){
String post_key = getRef(position).getKey();
Intent intent = new Intent(view.getContext(), RestaurantInfoActivity.class);
intent.putExtra("post_key", post_key);
view.getContext().startActivity(intent);
}
});
}
@NonNull
@Override
public RestaurantViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View view =LayoutInflater.from(parent.getContext())
.inflate(R.layout.restaurant_list,parent, false);
return new RestaurantViewHolder(view);
}
class RestaurantViewHolder extends RecyclerView.ViewHolder{
TextView restaurant_Name, restaurant_Category,restaurant_Location;
ImageView restaurant_Image;
public RestaurantViewHolder(@NonNull View itemView){
super(itemView);
restaurant_Name = itemView.findViewById(R.id.restaurant_Name);
restaurant_Category = itemView.findViewById(R.id.restaurant_Category);
restaurant_Location = itemView.findViewById(R.id.restaurant_Location);
restaurant_Image = itemView.findViewById(R.id.restaurant_Image);
}
}
}
ResRecyclerViewActivity
public class ResRecyclerViewActivity extends AppCompatActivity {
private static final String TAG = "ResRecyclerViewActivity";
private RecyclerView restaurantRecyclerView;
private RestaurantAdapter adapter;
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_restaurantlist);
Log.d(TAG, "onCreate: started.");
restaurantRecyclerView = findViewById(R.id.restaurant_rv);
restaurantRecyclerView.setLayoutManager(new LinearLayoutManager(this));
FirebaseRecyclerOptions<RestaurantDetails> options =
new FirebaseRecyclerOptions.Builder<RestaurantDetails>()
.setQuery(FirebaseDatabase.getInstance().getReference().child("Restaurant").child("Info"), RestaurantDetails.class)
.build();
adapter = new RestaurantAdapter(options);
restaurantRecyclerView.setAdapter(adapter);
}
@Override
protected void onStart() {
super.onStart();
adapter.startListening();
}
@Override
protected void onStop() {
super.onStop();
adapter.stopListening();
}
}
RestaurantDetails (Модель)
public class RestaurantDetails {
private String name;
private String location;
private String address;
private String category;
private String image;
private Double latitude;
private Double longitude;
public RestaurantDetails(String name, String location, String address, String category, String image, Double latitude, Double longitude) {
this.name = name;
this.location = location;
this.address = address;
this.category = category;
this.image = image;
this.latitude = latitude;
this.longitude = longitude;
}
public RestaurantDetails() {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getImage() {
return image;
}
public void setImage(String image) { this.image = image; }
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public Double getLatitude() {return latitude;}
public void setLatitude(Double lang) {this.latitude = latitude;}
public Double getLongitude() {return longitude;}
public void setLongitude(Double longitude) {this.longitude = longitude;}
}
Когда я отлаживаю приложение, это всплывающие комментарии. Ошибок не было