A debug library that overlays the class names of the current Activity and Fragment on the screen.

ScreenNameViewer overlays class names directly on the screen, allowing you to instantly identify the currently visible Activity or Fragment.
This makes it easier to locate the corresponding code, speeding up debugging and improving development efficiency.
- Real-time class name display: Shows Activity and Fragment class names on screen in real-time
- Automatic lifecycle management: Automatically tracks all Activities and Fragments at the Application level
- Debug-only: Automatically disabled in release builds for safety
- UI customization: Freely configure text size, color, position, etc.
- Memory safe: Prevents memory leaks using WeakReference
- Touch interaction: Touch overlay to show full class name in toast
Add the GitHub Packages repository to your project's settings.gradle.kts
:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/DongLab-DevTools/ScreenNameViewer")
credentials {
username = props.getProperty("github_username")
password = props.getProperty("github_token")
}
}
}
}
Add the library to your module's build.gradle.kts
:
dependencies {
implementation 'com.donglab.devtools:screennameviewer:latestVersion'
}
Create a gradle.properties
file in your project root with your GitHub credentials:
github_username=YOUR_GITHUB_USERNAME
github_token=YOUR_GITHUB_PERSONAL_ACCESS_TOKEN
Note
You need a GitHub Personal Access Token with read:packages
permission to download from GitHub Packages.
- Android API 21 (Android 5.0) or higher
Set up once and all Activities and Fragments will be automatically tracked:
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
initScreenNameViewer(this) {
settings {
debugMode { BuildConfig.DEBUG }
enabled {
PreferenceManager.getDefaultSharedPreferences(this@MyApplication)
.getBoolean("debug_overlay_enabled", true)
}
}
config {
textStyle {
size = 12f
color = Color.WHITE
}
background {
color = Color.argb(128, 0, 0, 0)
padding = 16
}
position {
topMargin = 64
activity = Gravity.TOP or Gravity.START
fragment = Gravity.TOP or Gravity.END
}
}
}
}
}
You can configure the library using a simple DSL (Domain Specific Language):
initScreenNameViewer(this) {
settings {
debugMode { BuildConfig.DEBUG }
enabled {
PreferenceManager.getDefaultSharedPreferences(this@MyApplication)
.getBoolean("debug_overlay_enabled", true)
}
}
config {
textStyle {
size = 12f // Text size
color = Color.WHITE // Text color
}
background {
color = Color.argb(128, 0, 0, 0) // Background color
padding = 16 // Padding
}
position {
topMargin = 64 // Top margin
activity = Gravity.TOP or Gravity.START // Activity display position
fragment = Gravity.TOP or Gravity.END // Fragment display position
}
}
}
-
settings: Configure activation conditions
debugMode
: Debug mode conditionenabled
: Overlay feature activation condition
-
config: Customize overlay appearance
textStyle
: Text size and colorbackground
: Background color and paddingposition
: Margin and display positions for different components
Donghyeon Kim |
JUNWON LEE |