Use with Caution. Some of this may be wrong or entirely unfounded.
Last Update: 4.5.2020
These Notes are just for me to avoid common pitfalls.
Views can be created via XML or programmatically.
This Section is about how to manipulate them.
Only every manipulate Views from the Thread that created them.
Almost everything you see in a View on Android has a Java Object equivalent
that can be obtained through Activity::findViewById.
Such as
Always do Networking on a Seperate Thread. Otherwise the App will crash.
You need a special line in AndroidManifest.xml to do Cleartext HTTP Networking.
Explanation
You can call this.finish() after calling startActivity(...) to deny the user the ability to reach this activity again with the back button. If the back button is pressed, the App will be quit, if you follow this pattern througout all your Activities.
final Intent i = new Intent(this, TargetActivity.class); startActivity(i); this.finish(); //prevent users from going back to this activity with the back button
<?xml version="1.0" encoding="utf-8"?> <resources> <color name="colorPrimary">#169148</color> <color name="colorPrimaryDark">#169148</color> <color name="colorAccent">#28A745</color> </resources>
implementation files('../../smartlogistics/target/smartlogistics-1.0-SNAPSHOT.jar')
For Validation, there is the excellent android-saripaar with Example.
Android Studio enables you to create virtual Devices. If that works for you, you can easily debug with log statements in the console and you will also see Stack traces.
For me, Android Studio doesn't recognize my Samsung Phone when it's plugged into the Computer.
And the virtual devices also do not work for some reason.
So I debug in a different style. By writing log statements to a file, and having a seperate View
in the App to view this file.
In ordinary Java development, most Exceptions could be caught with Exception.
On Android, Throwable should be used.
try{ //could throw }catch(Throwable e){ //your code }
You should start as early as possible. As soon as the app has anything that the user
can do, start working with the Google Play Console.
Last time i checked, they say it can take up to 7 days to approve the app for the play store.
In Android Studio:
Build -> Select Build Variant -> Release
Choose the .aab (Android App Bundle) format
(Google does like you to upload .apk for their Play Store).
Make a release build. Use a keystore to sign your app.
When starting Google Play Console, you see about 4 empty checkmarks on the left (navigation)
These are stages you must complete so that your App is considered ready for the Play Store.
It includes stuff like