public class MainActivity extends AppCompatActivity implements GetDataFromInternet.AsyncResponse {
private RecyclerView tasksRecyclerView;
private ToDoAdapter tasksAdapter;
private FloatingActionButton fab;
public float temp_r;
private List<ToDoModel> taskList;
private DatabaseHandler db;
private static final int NOTIFY_ID = 101;
private static final String TAG = "MainActivity";
final String CHANNEL_ID = "Important_mail_channel";
Button mBtnSimpleNotification;
NotificationManagerCompat mNotificationManagerCompat;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getSupportActionBar().hide();
try {
URL url = new URL("https://api.openweathermap.org/data/2.5/weather?q=Moscow&appid=bc3c769785e409da05b5fca6ab83f12b");
new GetDataFromInternet(this).execute(url);
} catch (MalformedURLException e) {
e.printStackTrace();
}
createNotificationChannel();
mBtnSimpleNotification = findViewById(R.id.btn_notification);
mBtnSimpleNotification.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
createSimpleNotification("Simple Notification", temp_r, 1);
}
});
mNotificationManagerCompat = NotificationManagerCompat.from(MainActivity.this);
db = new DatabaseHandler(this);
db.openDatabase();
taskList = new ArrayList<>();
tasksRecyclerView = findViewById(R.id.tasksrecycleView);
tasksRecyclerView.setLayoutManager(new LinearLayoutManager(this));
tasksAdapter = new ToDoAdapter(db, this);
tasksRecyclerView.setAdapter(tasksAdapter);
fab = findViewById(R.id.fab);
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new RecyclerItemTouchHelper(tasksAdapter));
itemTouchHelper.attachToRecyclerView(tasksRecyclerView);
taskList = db.getAllTasks();
Collections.reverse(taskList);
tasksAdapter.setTasks(taskList);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AddNewTask.newInstance().show(getSupportFragmentManager(), AddNewTask.TAG);
}
});
}
@Override
- и тут он ругается, что нельзя из-за супер класса
Но я не знаю, как исправить