'Method does not override method from its superclass? android studio [duplicate]
I have download this source code from github and copied to my project. Does anyone know the solution. Please tell me the answer.
enter code here
@Override
public void onStart(){
super.onStart();
FirebaseRecyclerAdapter<Data, IncomeViewHolder> incomeAdapter=new FirebaseRecyclerAdapter<Data, IncomeViewHolder>(
Data.class,
R.layout.dashboard_income,
DashboardFragment.IncomeViewHolder.class,
mIncomeDatabase
) {
@NonNull
@Override
public IncomeViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return null;
}
@Override
protected void onBindViewHolder(@NonNull IncomeViewHolder holder, int position, @NonNull Data model) {
}
//error in overide
**@Override**
private void populateViewHolder(IncomeViewHolder incomeViewHolder, Data data, int i) {
incomeViewHolder.setIncomeType(data.getType());
incomeViewHolder.setIncomeAmount(data.getAmount());
incomeViewHolder.setIncomeDate(data.getDate());
}
Solution 1:[1]
"Method does not override method from its superclass" means a method isn't a method of it's superclass, but is annotated as @Override
. In your case, populateViewHolder(IncomeViewHolder, Data, int)
isn't a method of it's superclass. You can either remove the @Override
annotation or extend the appropriate superclass
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | iLittleWizard |