View Manipulation
Method Calls to avoid
Boilerplate Codes
Form Validation
Relevant Classes
Debugging, Exceptions
Publish on
Google Play Store


My Android Dev Notes (Java)

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.

View Manipulation

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

Method Calls to avoid (this may be entirely unfounded)


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

Activities and Intents

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.

General Advice

Boilerplate Codes

To start a new Activity
final Intent i = new Intent(this, TargetActivity.class);
//prevent users from going back to this activity with the back button
To Change the Colors of your App (res/values/colors.xml)
<?xml version="1.0" encoding="utf-8"?> 
	<color name="colorPrimary">#169148</color> 
	<color name="colorPrimaryDark">#169148</color> 
	<color name="colorAccent">#28A745</color> 
To depend on your own libraries (build.gradle)
implementation files('../../smartlogistics/target/smartlogistics-1.0-SNAPSHOT.jar')

Form Validation

For Validation, there is the excellent android-saripaar with Example.

Relevant Classes

Debugging and Exception Handling

Android Virtual Devices and Debugging with Android Studio

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.

Poor Man Debugging

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.

Uncaught Exception Handler
To catch Exceptions (use Throwable to catch them all)

In ordinary Java development, most Exceptions could be caught with Exception.
On Android, Throwable should be used.

	//could throw
}catch(Throwable e){
	//your code

Publish on Google Play Store

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.

Official Guide
Google Play Console

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