All Questions
54 questions
1
vote
1
answer
119
views
How can I refactor complicated method with views in Activity or Fragment?
I am learning Clean Code and Refactoring. And my project has many long method with view access, something like this.
private fun updateStatusFragmentUI(statusData: StatusListData.StatusData) =
...
2
votes
1
answer
69
views
How to make a SELECT from MySQLite without locking the UI?
I have an issue with my Activity, that's an old Android project which I'm trying to refactor a bit to increase the performance of the App.
In onCreate I'm doing a SELECT of data from different tables ...
0
votes
1
answer
85
views
Android/java - best practice for breaking up one large class full of calculations
I am working on a simple sleep-aid app that allows users to choose a starting number of breaths per minute, a goal number of breaths per minute, and a total duration. The app then flashes a dim light ...
0
votes
2
answers
692
views
How to refactor method with more than 6 parameters in the kotlin
I need to make a request in an api, and I have to send 11 parameters, but using a code analysis tool, inform that I must send a maximum of 6. There would be some form of refactoring for me to send ...
-1
votes
2
answers
74
views
How could I refactor this bit of code here to achieve the same result?
I am working on an app for school. I was looking through the code and found this thing I made:
if (answerTxt1.getText().toString().matches("")) {
infoStatus.setText("Answer1 cannot be empty!")...
0
votes
0
answers
144
views
How to refactor a big recyclerview adapter?
I have a very big recyclerView in my code with a lot of if statements in the onBindViewHolder: sometimes position 1 to 5 will have this view, sometimes they will have another view, and some other ...
0
votes
5
answers
395
views
Correct way to refractor if-statements
I wonder if this is a good way to refactor multiple if statements? What I have heard is that if-statements are "bad" practice and i would like to take my programing to the next level by refactor some ...
0
votes
0
answers
202
views
How to refactor the error handling for a method with multiple steps?
I have a method that comprises of 5 steps. Each step is a network call that may fail with a 403,404 etc. One of my coworker asked me to refactor the code because he thought there was a better way than ...
0
votes
2
answers
203
views
Creating a "pro" version of an app with different package name
I would like to create a "pro" version of my Android app.
I have to slightly change the app name, and the package name, and so on.
I tried the refactor command (renaming com.appname.app into com....
0
votes
2
answers
272
views
Is there a refactoring tool to extract colors as a resource [duplicate]
I currently defined my colors as constants, for example:
public static final int BG_COLOR = Color.parseColor("#262525");
I want to better my life and define all colors in my colors.xml file, for ...
2
votes
4
answers
832
views
Android use unique onDestroy for all activities
I have an app with several activities and the action to perform on destruction is actually the same, no matter what the Activity is at that moment (deleting some data and performing a HTTP call).
Is ...
2
votes
0
answers
68
views
Effcient merge strategy for Live project after/while refactoring and re structuring code
What I have
V2 android project that is live and in maintenance by different team . This project get lots of bug fixes committed.
V3 project(not live) -This is branched from V2 project & minor ...
0
votes
1
answer
91
views
How can I refactor a Helper class that requires a context from two different Adapters?
I have the following Helper class that I keep in a folder alongside my adapters. The problem is there is unnecessary duplication. I need the context of either adapter, depending on where the helper is ...
2
votes
3
answers
3k
views
Refactoring code with too many switch cases
I have inherited an application which needs some refactoring. The following is giving me some headaches. The original source code has too many switch cases like the following:
class Girl {
//...
...
2
votes
1
answer
126
views
Git: Unable to clean working copy after refactoring file names
I somehow cause git to get all confused after renaming a directory in a Java project. There are now a whole bunch of phantom files sitting in my working copy for the old file name that I can't seem ...