Answer the question
In order to leave comments, you need to log in
How to reuse code for android apps?
Hello!
I am now understanding Android programming and the question arose of how to write the code correctly so that it can also be used in other applications?
I have an activity that displays several items to the user:
Answer the question
In order to leave comments, you need to log in
1. Perhaps, for this you need to create your own class of a button, spinner, EditText, whatever
public class CustomEditText extends EditText {
// Твоя логика, можно написать тут свои листенеры а в Activity передавать Spinner чтобы подписываться на его изменение
}
<your.package.CustomEditText
...
/>
class SharedPreferenceUtil {
private final SharedPreferences preferences;
private SharedPreferenceUtil (Context context) {
preferences = context.getSharedPreferences(PREFERENCES, Context.MODE_PRIVATE);
}
public int getValue() {
return preferences.getInt(PREFERENCE_VALUE, 0);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question