[Q] Proper way to use SQLite? - Java for Android App Development

So I created an app long ago, and back then to read from a SQLite DB was to use a managed cursor with startManagingCursor().
Now, that is not only depreciated, but also not available in fragments. They say use a Loader, which requires CursorLoader, which apparently generally requires a ContentProvider. But if you look in the Content Provider documentation, it says "You don't need a provider to use an SQLite database if the use is entirely within your own application."
So, I can't use a managed cursor, but then I also shouldn't use a ContentProvider. I don't need to share this data with any other apps. This is a small app, with small databases, only for my app. Do I need to write my own Loader? It seems crazy that managing data in a database has become complex for some pretty basic data storing/managing.
Am I missing something? Is there a better way to get data from an SQLite database on Android? What does everyone else do?

http://www.vogella.com/tutorials/AndroidSQLite/article.html
---------------------------------
Phone : Nexus 4
OS :
- KitKat 4.4.4 stock
- Xposed: 58(app_process); 54(bridge)
- SU: SuperSU
- no custom recovery
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk

Related

[Q] how to hardcode url navigation webview

Im using a webview to display a website.
The page iam opening using loadurl method is the login page, on successful login redirection occurs to a particular page .
I want to skip that page i.e dont want to show that page rather show the webpage after that
eg If my webview starts with webpage A
on login success it shows webpage B
and then next page is webpage C
i want after Login success in page A it should go automatically to webpage C
Click to expand...
Click to collapse
current code im using
Code:
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (Uri.parse(url).getHost().trim().equals("https://www.test.com")) {
web.loadUrl("https://www.test1.com");
}
return false;
}
so any tips/pointers as to how i do this? thanks
Maybe you load the webview in a background task without updating the ui and then execute the test method you mentioned above and only update the webview ui once you determined whether you must override the url. Not sure if that is possible but maybe it is
---------------------------------
Phone : Nexus 4
OS:
Pure KitKat 4.4.2 stock, no root, no mods
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk

Cannot resolve symbol "charSequence"

Hi first time here and first time trying to write android code. Ive done java in eclipse earlier. anyway i follow some guide on utube and he writes charSequence. however I dont seem to have that cause it get red, do i need to import some library?
Well if you don't capitalize the first letter it will be a variable name instead of a data type...
CharSequence charSequence = ....
This should work better
But hey, this is a really really basic thing about java and coding in general, always check if you did the capitalization right!
---------------------------------
Phone : Nexus 4
OS :
- KitKat 4.4.4 stock
- Xposed: 58(app_process); 54(bridge)
- SU: SuperSU
- no custom recovery
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk
As said Masrepus, CharSequence is a class. And all class begin with a capitalize letter.
all other words are variable (if not keyword like if, switch, case, try, etc...) or function name

[Q] Secondary icon in notification

Hi
Firstly I apologise if I have put this into the wrong section within the forum.
I'm wanting to remove the secondary icon from a notification within a particular app. Also on some apps like WhatsApp it will also show a notification count (next to the secondary icon) Please see below link which gives an example.
//developer.android.com/design/patterns/notifications_k.html
Which line of code do I need to find and remove so the secondary icon and notification count no longer appears?
Thanks.
There will be called NotificationBuilder at some instance and there look for a method call to setSmallIcon(...)
---------------------------------
Phone : Nexus 4
OS :
- KitKat 4.4.4 stock
- Xposed: 58(app_process); 54(bridge)
- SU: SuperSU
- no custom recovery
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk
When searching through the code I found a few lines looking like this;
invoke-virtual {v1, v2, v3}, Landroid/app/Notification$Builder;->setSmallIcon(II)Landroid/app/Notification$Builder;
When I removed each line then the application crashed prior to the notification being displayed in the status bar. Meaning no notification was shown, however I was still able to open the app.
What would I need to change in this line to prevent the secondary icon from displaying?
Thanks.

Trying to get files from ftp server

Hello all
i'm trying to make a button that connects to an ftp server and download a bunch of files
i have everything figured out , but i'm wondering how to execute it , should i use asynctask ?
i want to also update progress and such ...
the files will be around 60MB so i don't know how long it will take , a few minutes i guess depends on the connection .
is there a more suitable answer than asynctask ?
thanks to all helpers !
I think asynctask would be a nice solution, progress updating is included as well (publishProgress(int progress) and then by overriding onProgressUpdate(...) you can access ui elements)
---------------------------------
Phone : Nexus 4
OS :
- KitKat 4.4.4 stock
- Xposed: 58(app_process); 54(bridge)
- SU: SuperSU
- no custom recovery
---------------------------------
4d 61 73 72 65 70 75 73 20 66 74 77
Gesendet von Tapatalk

LG G4 v29a magisk + safetynet pass + debloat + adaway - Howto guide

Hey guys.
I am using magisk 15.3 to debloat the v29a system systemlessly.
Systemless Debloat with the magisk module (terminal debloater) means that the system partition isn't touched!
Hence, it don't breaks safetynet (also with the help of Universal safetynet fix beta 5).
Requirements:
BL unlocked
TWRP installed, up and running
Here is a short how to guide:
When you already on v29a and you have modify the system partition (adaway, supersu, TiBu,...) just flash the stock v29a system partition again and don't touch it (no supersu, no adaway,...)!
Here is the link: https://forum.xda-developers.com/g4/development/h815-nougat-stock-t3659860
Flash magisk 15.3 in TWRP and boot up.
Here is the Link: https://forum.xda-developers.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445
Go into magisk manager and check safetynet status. In my case cts profile fails. No problem...
Go into twrp and flash the universal safetynet beta 5 fix. DONT USE the stable, use the BETA!
Here is the link: https://forum.xda-developers.com/apps/magisk/xiaomi-safetynet-fix-t3600431
Restart phone and check safetynet status. It should pass booth checks.
Now you are rooted and pass safetynet. You can install and use Netflix, Super Mario Run, banking apps... victory
To get adaway working and not breaking safetynet, open it, go to settings and set the hosts file location to /data/. Press update/install hosts file. Adaway will ask you to create a symlink on system. Do it, this will not break safetynet!
From magisk manager you can install "terminal debloater" and use my list to Debloat the rom without breaking safetynet.
Here is the List:
1 - Google Play Books
2 - DRM Service
3 - Docs
4 - Sheets
5 - Slides
6 - GNSS Air Test
7 - gnsslogcat
8 - LG GNSS 2.1
9 - GnssTest 1.2
10 - Google Text-to-speech Engine
11 - HTML Viewer
12 - Hangouts
13 - Hidden Menu
14 - HiddenSIMUnlockMenu
15 - LG Account
16 - LGAirDrive
17 - LG Backup Launcher
18 - LGDrm
19 - FOTA Update
20 - Audio share
21 - LGSmartcardService
22 - Smart cleaning
23 - LGWernickeManager
24 - LteConfigs
25 - Google Play Newsstand
26 - PacProcessor
27 - Google Play Games
28 - Google+
29 - Print Spooler
30 - Use DLNA feature
31 - SmartShareProvider
32 - Google Play Movies
33 - Wfd Service
34 - atfwd
35 - ELTest
36 - ServiceMenu
37 - TalkBack
38 - BackupRestoreConfirmation
39 - LG Health Agent
40 - Cloud
41 - Battery drain info
42 - GCUV
43 - Game battery saver
44 - IceContacts
45 - InCalAgent
46 - LG AirDrive
47 - Clock
48 - App Updates
49 - LG Mobile Switch
50 - Internet
51 - Calculator
52 - Calendar
53 - Cell Broadcast
54 - Smart Notice
55 - Contacts
56 - LGSmartCover
57 - Software update
58 - Email
59 - Exchange
60 - File Manager
61 - FormManager
62 - Answer me
63 - LGInstallService
64 - LDB
65 - LGMapUI
66 - Messaging
67 - Music
68 - Music
69 - LG P2p Service
70 - LG Bridge Service
71 - LGPartnerBookmarksProvider
72 - LG RCS Services
73 - RcsCall
74 - SharedSketch
75 - SnapPage
76 - Tasks storage
77 - Update Center
78 - Voice Recorder
79 - LG WFDS Services
80 - LIA Informant
81 - LIA S4URecommender
82 - LG Connectivity Service
83 - My Places Engine
84 - My Place
85 - RCSProvider
86 - SmartSetting
87 - Tags
88 - qcrilmsgtunnel
Click to expand...
Click to collapse
Now you are rooted, have adaway, pass safetynet & debloated all the LG s*** out of this rom.
Go to the magisk manager download section and find other great systemless mods
THX goes to:
@twrp team and @steadfasterX for TWRWP
@kessaras for v29a flashable zip
@Deic for universal safetynet fix beta 5
All the others I forgot.
pOpY
What does the author of this thread mean by "systemless debloat"?
Isn't just disabling/freezing apps enough?
Also, how can you pass safetyNet? I cannot pass it even with safetyNet Universal fix...
Reserved
So, there is no way to pass Safety net with roms like H-rom g4 or even worse, Los, right?
polfrank said:
So, there is no way to pass Safety net with roms like H-rom g4 or even worse, Los, right?
Click to expand...
Click to collapse
Sorry, i havent installed the roms and just done this on v29a stock.
Have updated the Op with better instructions on how i have done it.
Would be nice if you could try it and report back.
pOpY
polfrank said:
So, there is no way to pass Safety net with roms like H-rom g4 or even worse, Los, right?
Click to expand...
Click to collapse
I was passing Safety net back on the last Official LOS 14.1 using at the time 15.0 Magisk, universal safety fix and magisk hide. I don't remember all the settings, Now I am on CypherOS and still passing with 15.3 and universal. I mod and change my /system all the time and pass.
What is your setup? Maybe with more information I can help.
Edit: also nice post OP. I'll probably be installing Adaway soon, just never bothered. Also for the terminal debloater, what exactly does that do? Just hide the apps? I mainly just use the TWRP terminal and remove apps from /system that way, but I leave some that I am unsure if they are needed or not. Do you know which ones are always required?
Thx, for your kind words.
Adaway is a must have [emoji3]
No ads, yeah.
Regarding the terminal debloater module, it removes the apk and write a placeholder file. The result is the same like you do (remove the apk), BUT you can disable the whole module or enable single apps and system partition isn't touched!
The list above I have written down from several threads and by trial and error.
Until now, no issues...
Wait... One.. Better battery life [emoji56]
pOpY
Gesendet von meinem LG-H815 mit Tapatalk
popy2006 said:
Thx, for your kind words.
Adaway is a must have [emoji3]
No ads, yeah.
Regarding the terminal debloater module, it removes the apk and write a placeholder file. The result is the same like you do (remove the apk), BUT you can disable the whole module or enable single apps and system partition isn't touched!
The list above I have written down from several threads and by trial and error.
Until now, no issues...
Wait... One.. Better battery life [emoji56]
pOpY
Gesendet von meinem LG-H815 mit Tapatalk
Click to expand...
Click to collapse
Thats pretty cool. I may check it out soon. I'm trying to not to use a lot of Magisk modules on such a new rom (CypherOS 5.1) to be sure everything works. But better battery life is my aim right now. Thanks for the explanation.
tambukey said:
Thats pretty cool. I may check it out soon. I'm trying to not to use a lot of Magisk modules on such a new rom (CypherOS 5.1) to be sure everything works. But better battery life is my aim right now. Thanks for the explanation.
Click to expand...
Click to collapse
You are welcome
Final step, OPEN Terminal Emulator and type:
su
debloat
^^the app list to debloat (in OP) are found in both options #1 and #2
One note: Print Spooler is necessary if you plan to print any documents/pictures onto paper from a printer.
Thanks for the guide!!
Guys I can't run Magisk on my LG G4 H815 with Nougat v29a. After removing Supersu and flashing magisk 17.1 with twrp, the phone doesn't boot normally. It reboots recovery when I click reboot system. It always reboot recovery. I don't know why.
Do you have any Idea?
Use magisk 16.0, that's the version I am using. With 17 and 17.1 I also had those issues.
Good luck
pOpY
Gesendet von meinem LG-H815 mit Tapatalk

Categories

Resources