最近我将“ com.firebaseui:firebase-ui:0.6.2”更新为“ com.firebaseui:firebase-ui:3.3.0”,但此后无法解析FirebaseRecyclerAdaptesr并导入com.firebase.ui.database。 FirebaseRecyclerAdapter”。有什么问题以及如何解决?请帮助我。
这是我的代码
RecyclerView recyclerView;
RecyclerView.LayoutManager layoutManager;
GridLayoutManager mLayoutManager; //for sorting
SharedPreferences mSharedPref; //for saving sort settings
FirebaseDatabase database;
DatabaseReference MCC, mRef;
String categoryId = "";
FirebaseRecyclerAdapter<computerSubModel, computerSubViewHolder> adapter;
//Search Bar
FirebaseRecyclerAdapter<computerSubModel, computerSubViewHolder> SearchAdapter;
List<String> suggestList = new ArrayList<>();
MaterialSearchBar materialSearchBar;
Button btn;
private static final String APP_ID = "ca-app-pub-8867939169855032~9998384849";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_android_developing_sub);
MobileAds.initialize(this,APP_ID);
AdView adView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
btn = (Button) findViewById(R.id.backbutton);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent toy = new Intent(AndroidDevelopingSubActivity.this, AndroidDevelopngTopicActivity.class);
startActivity(toy);
}
});
database = FirebaseDatabase.getInstance();
MCC = database.getReference("1AndroidDevelopingSub");
recyclerView = (RecyclerView) findViewById(R.id.recycler_AndroidDeveloping);
recyclerView.setHasFixedSize(true);
layoutManager = new LinearLayoutManager(this);
recyclerView.setLayoutManager(new GridLayoutManager(this, 1));
if (getIntent() != null)
categoryId = getIntent().getStringExtra("CategoryId");
if (!categoryId.isEmpty() && categoryId != null) {
loadListThrillerSubModel(categoryId);
}
}
private void loadListThrillerSubModel(String categoryId) {
adapter = new FirebaseRecyclerAdapter<computerSubModel, computerSubViewHolder>(computerSubModel.class,
R.layout.computer_sub_items,
computerSubViewHolder.class,
MCC.orderByChild("menuid").equalTo(categoryId)) {
@Override
protected void populateViewHolder(computerSubViewHolder viewHolder, final computerSubModel model, int position) {
viewHolder.thrillersub_title.setText(model.getTitle());
final computerSubModel local = model;
viewHolder.setItemClickListner(new ItemClickListner() {
@Override
public void onClick(View view, int position, boolean isLongClick) {
Intent detailsIntent = new Intent(AndroidDevelopingSubActivity.this, AndroidDevelopingVideoActivity.class);
detailsIntent.putExtra("CategoryId", adapter.getRef(position).getKey());
startActivity(detailsIntent);
}
});
}
};
recyclerView.setAdapter(adapter);
}
答案 0 :(得分:0)
使用
implementation 'com.firebaseui:firebase-ui-database:3.3.0'
代替
implementation 'com.firebaseui:firebase-ui:3.3.0'