-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blank screen#240 fix #241
base: main
Are you sure you want to change the base?
Blank screen#240 fix #241
Conversation
finish(); | ||
|
||
|
||
runOnUiThread(new Runnable() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was runOnUiThread
added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While running application on local i faced an issue where after coming back to app it was running on different thread while loading data on to Screen. So i used runOnUiThread to in UI thread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While running application on local i faced an issue where after coming back to app it was running on different thread while loading data on to Screen. So i used runOnUiThread to in UI thread.
@arvind-1 Are you saying that the application was already downloading content from the REST API when you came back to the app after having opened it previously? If that's the case, maybe it would be better if we implement code that will cancel the download if the user leaves the activity (onStop()
) before the download completes?
CC @gscdev
@@ -65,13 +65,21 @@ protected void onStart() { | |||
RoomDb.databaseWriteExecutor.execute(() -> { | |||
List<Application> applications = applicationDao.loadAll(); | |||
Log.d(getClass().getName(), "applications.size(): " + applications.size()); | |||
applicationListAdapter.setApplications(applications); | |||
|
|||
if(null!=applications) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to if (applications != null) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok i will update it.
app/src/main/java/ai/elimu/appstore/ui/applications/ApplicationListActivity.java
Show resolved
Hide resolved
app/src/main/java/ai/elimu/appstore/ui/applications/ApplicationListActivity.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had trouble understanding what the code changes were doing. Maybe you could add some in-line comments for increased readability?
if(applications != null) { | ||
applicationListAdapter.setApplications(applications); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(applications != null) { | |
applicationListAdapter.setApplications(applications); | |
} |
This code change is not necessary, right? (Since applicationListAdapter.notifyDataSetChanged();
is the line causing the error.)
List<ApplicationVersion> applicationVersions = applicationVersionDao.loadAll(); | ||
Log.d(getClass().getName(), "applicationVersions.size(): " + applicationVersions.size()); | ||
applicationListAdapter.setApplicationVersions(applicationVersions); | ||
|
||
applicationListAdapter.notifyDataSetChanged(); | ||
|
||
recyclerView.post(new Runnable() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid the dependence on recyclerView
, use runOnUiThread
instead?:
recyclerView.post(new Runnable() { | |
runOnUiThread(new Runnable() { |
applicationListAdapter.notifyDataSetChanged(); | ||
} | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No description provided.