Click here to Skip to main content
16,016,669 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm working on a simple forum app which enables the user to upload texts and pictures. Everything was working fine with little bugs, then on the process of debugging, i really have no idea what happened. The output of the program is affected, here is the full code Here<a href="">https://github.com/XBlack97/UNNCrimeWatch</a>

The app uses a navigationDrawer with 2 fragments, one to show uploaded posts, the other for uploading..


PROBLEMS

1)onBindViewHolder of the NewsAdapter: The stored arrays of uri converted to strings no longer display in the horizontal recyclerView inside the News (Vertical RecyclerView )

2)i don't know if the Uris are even stored or not

3)public void removeAt(int position, Uri path): The RecyclerView of images deletes but the created files in the directory doesn't deletes.


What I have tried:

Tried setting adapter of horizontal recycler view in vertical recycler view adapter
Posted
Comments
MadMyche 12-Sep-19 6:58am    
Sorry, but in my world "Quick Answers" does not require me to go off-site and look through your code repository to figure out an answer for you.Please at the very least find the block of code that is in question and past that code in here.. I see you already know how to use copy and paste so this shouldn't be too hard

1 solution

2) I don't know if the Uris are even stored or not.

A way to ascertain this (assuming that you are using Android Studio), is to run the App and add some items and to then use device explorer to copy the database into a SQLite Management Tool, such as Navicat or DB Browser for SQLite.

Note that if there are 3 files at data/data/<your_package>/databases/ (namely cw.db, cw.db-shm & cw.db-wal) then copy all three files.


Doing the above results in (after 3 items have been added)

mId	mDate	        mUpdate	mImageUris
1	1568316328566	test	[]
2	1568316509923	test2	[]
3	1568317094203	test3	[]


So it appears that the answer is no, the URI's are not being stored.

The next stage is to ascertain why not.

Placing a breakpoint at :-

CWDatabaseAccessor
         .getInstance(getApplication())
         .cwDAO()
         .insertUpdate(update);


shows that mImageUris has 0 elements.

Adding a breakpoint at the line

if (newsImagesuri != null) {


Shows that the result from line
newsImagesuri = mImagesAdapter.getImageUris();


is that newsImagesuri is an empty array.

As such your issue would very much appear to be based in the getImageUris method of the mImagesAdapter class or before.


1)onBindViewHolder of the NewsAdapter: The stored arrays of uri converted to strings no longer display in the horizontal recyclerView inside the News (Vertical RecyclerView )

and

3)public void removeAt(int position, Uri path): The RecyclerView of images deletes but the created files in the directory doesn't deletes.

It is likely that the empty URI's is the underlying issue for both of these.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900