Answer the question
In order to leave comments, you need to log in
How to extract a variable from a method for use in another class?
Good afternoon. I'm new to Java and Android, I can't seem to get information out of a method and move it to another class. Briefly: there is a custom Calendar connected to the project as a library, there is a separate module that has the MainActivity class, it has a method:
@Override
public Date onDayClick(Date date) {
Toast.makeText(this, "onDayClick: " + date, Toast.LENGTH_SHORT).show();
return date;
}
Answer the question
In order to leave comments, you need to log in
Another class is Activity/Fragment? Yuzai
Intent intent = new Intent('класс');
Bundle bundle = new Bundle();
bundle.putString("date",calendar.getDate().toString());
intent.putExtra(bundle);
startActivity(intent);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question