public abstract class MypageActivity {
private RecyclerView recyclerView;
private RecyclerView.Adapter mAdapter;
Map<String,Object> boxOfficeResult;
private ArrayList<Map<String, Object>> jsonList;
protected void onCreate(Bundle savedInstanceState) {}
MySwipeHelper swipeHelper= new MySwipeHelper(MypageActivity.this,recyclerView,300) {
@Override
public void instantiatrMyButton(final RecyclerView.ViewHolder viewHolder, List<MyButton> buffer) {
buffer.add(new MyButton(MypageActivity.this,
"Delete",
30,
R.drawable.ic_delete_white_24dp,
Color.parseColor("#FF3C30"),
new MyButtonClickListener() {
@Override
public void onClick(int pos) {
Toast.makeText(MypageActivity.this, "Delete click", Toast.LENGTH_SHORT).show();
Log.d("TAG",viewHolder.getAdapterPosition()+"");
jsonList.remove(viewHolder.getAdapterPosition())); // Delete that item
mAdapter.notifyItemRemoved(viewHolder.getAdapterPosition()); // Inform Adapter
}
}));
buffer.add(new MyButton(MypageActivity.this,
"Update",
30,
R.drawable.ic_edit_edit_24dp,
Color.parseColor("#03DAC5"),
new MyButtonClickListener() {
@Override
public void onClick(int pos) {
Toast.makeText(MypageActivity.this, "edit click", Toast.LENGTH_SHORT).show();
//
}
}));
}
};// };// swipeHelper
}
Only toast messages fail.
Error Code)
error: incompatible types: MypageActivity cannot be converted to Context
MySwipeHelper swipeHelper= new MySwipeHelper(MypageActivity.this,recyclerView,300) {
It's the same as the error message.
MypageActivity cannot be converted to Context
If you look at the code now, MypageAcitivy is a class that doesn't inherit anything.
In other words, the name is Activity, not Activity.
That's why you get this error message.
public abstract class MypageActivity {}
public abstract class MypageActivity extends AppCompatActivity {}
I want you to inherit it.
© 2024 OneMinuteCode. All rights reserved.