This week's giveaway is in the Java in General forum.
We're giving away four copies of Java Challengers and have Rafael del Nero on-line!
See this thread for details.
Win a copy of Java Challengers this week in the Java in General forum!

adrian rowlands

Greenhorn
+ Follow
since Apr 30, 2021
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
1
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by adrian rowlands

adapter

2 days ago

[/code]
2 days ago
i have an app where i can store customer information and job details in a table, these details are then read and displayed on another activuty using recyclerview and cardviews , i have also set up the ability to click each one and load an update activity where it takes the information from the selected card and fills out edittexts on another activity this works for the edit text fields but i dont know how i can get this to select the right spinner item?
i have 2 spinners set up both filled with items from an xml file, how do i read through the spinner items and compare it to the stored string value and select that item when the activity loads?

update activity


2 days ago

Tim Holloway wrote:Don't despair. It's not that hard and it does work reliably. There's probably some simple mistake you made that, when fixed, magically makes the whole thing work. That's usually how it is for me. Although it usually takes 3-4 days of swearing and finally getting a junior programmer to point out I'm missing something trivial.

Being that this is Android, probably one of the trickiest things to know is what methods get called when, since Android does much of the calling, not your code. Adding some tracing statements to the log (or IDE breakpoints) can help with that.

If you're new to Java, though, learning Java AND Android at the same time is going to be harder than learning just Java.



I'll take a look in the later/morning what are tracing statements?
1 week ago

Tim Holloway wrote:I expected that you would say that.

But all that means to me is that either you've accidentally created more than one instance of your SQLiteDBOpenHelper class and haven't initialized the one you're currently using, or you've managed to nuke/re-initialize the one you were using.



well ive started again and followed a youtube tutorial to create a basicapp to add to database and update, and ive gone through it exactly and the update doesnt actually work so i give up
1 week ago

Paul Clapham wrote:

Tim Holloway wrote:The way I read that is that you didn't create the database itself.



I agree, it looks like the problem is to do with accessing the database rather than with processing the query. Notice that there's a method named getReadableDatabase near the top of the stack trace, higher than deleteCustomer. And the error appears to be related to finding the location of the database ("getDatabasePath").

If my theory is correct then executing any query should have the same result, or maybe only any query which wants to update the database.



I can add to the data base fine, read it and display the items in the database so.

Any suggestions where I should look for the the issue?
Or maybe just start from scratch?
1 week ago
Tried this still get same issue
1 week ago
adjusted the delete method but still not working

i get this error in the log cat

1 week ago
i am trying to set up a delete button to delete a customer from a table, the customers are displayed in card views using a recycler view so each customer will have their own delete button, the customer information are displayed using textviews. i need to pass the customer id to the delete method i order to search the table for that specific id to delete. how do i pass the data succesfully?

this is what iver currently got to try and pass the data i need

passing data to method


delete method
1 week ago

Randy Tong wrote:I think you'r pasting log message instead of the error.The error should look similar to this




1 week ago

Randy Tong wrote:

adrian rowlands wrote:the second one was what showed up in the stack trace


No, that's not the stacktrace. The stacktrace is the error message which made your app  crashed. You can find the stacktrace in logcat window (if you using Android Studio).



i get these errors in the log cat when i run it

2021-04-30 13:53:36.187 22070-22070/? E/Zygote: isWhitelistProcess - Process is Whitelisted
2021-04-30 13:53:36.188 22070-22070/? E/Zygote: accessInfo : 1
2021-04-30 13:53:36.215 22070-22070/? E/andsflooringap: Unknown bits set in runtime_flags: 0x8000
these warnings
2021-04-30 13:54:42.472 23420-23420/com.example.rowlandsflooringapp W/andsflooringap: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
2021-04-30 13:54:42.473 23420-23420/com.example.rowlandsflooringapp W/andsflooringap: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
2021-04-30 13:54:42.620 23420-23804/com.example.rowlandsflooringapp W/Gralloc3: mapper 3.x is not supported
1 week ago

Randy Tong wrote:Why do you need to call deleteCustomer twice ? Between, don't forget to post your stacktrace.


noticed i had it in there twice after posting, deleted it now
the second one was what showed up in the stack trace
1 week ago
[

Randy Tong wrote:paste your latest code and the stacktrace.






added that the customer class along with the deleteCustomer function in the customerdb



when i go onto the screen it just gives me a white screen then goes back to log in screen

stack trace



so obviously something is wrong with the deleCustomer method, im probably way off the right code for it lol
1 week ago

Randy Tong wrote:Here the ideas:

1. Create a delete function (Eg: removeItem ) in CustomerDB class.
2. When the delete button is clicked, pass the id to removeItem method.
3. Execute the delete query in removeItem method.
4. Refresh recyclerView.



app crashes when i add a onclicklistener for the button and go to that screen
1 week ago
I am creating a basic app where i can add customers to a database and display them on another screen, i have set up everything using recyclerview and card views to display the customers and that works fine, but im not sure how i set it up so that i can delete the customers. i have added a button to each of the customers that will be used to delete them.

customer database


adapter


customer class


any help would be appreciated
1 week ago