Overview
Dynamic strings allow you to update your app’s text content instantly without releasing a new version to the Play Store. Change marketing copy, fix typos, run time-sensitive campaigns, or adjust messaging—all from the Stringboot Dashboard.Key Benefits
Instant Updates
Change text content without app releases or user updates
Offline-First
Strings cached locally—works without internet connection
Zero-Code Updates
Use XML tags for automatic string injection
Reactive UI
Automatic UI updates when strings change
Quick Start
1. Add String to Dashboard
Go to Stringboot Dashboard → Strings → Add New String:- Key:
welcome_message - Value:
"Welcome to our app!" - Language:
en
2. Use in Your App
- XML Tag Method (Recommended)
- Programmatic Method
- Reactive Flow Method
Step 1: Add Step 2: Apply Stringboot tags in your Activity:That’s it! The TextView automatically shows “Welcome to our app!” and updates whenever you change it in the dashboard.
android:tag to your TextView:activity_main.xml
MainActivity.kt
3. Update from Dashboard
Go to Strings → Editwelcome_message → Change to "Welcome back!" → Save
Your app automatically shows the new text next time it syncs (happens automatically on app launch).
String Retrieval Methods
1. XML Tag-Based (Recommended)
The simplest method: setandroid:tag and call applyStringbootTags().
res/layout/activity_product.xml
ProductActivity.kt
- Zero boilerplate code
- Updates all tagged views at once
- Perfect for static layouts
- Automatically handles missing strings
- Most TextView, Button, and static UI elements
- Marketing pages and static content
- Forms with static labels
2. Synchronous Get
Get strings immediately from cache without suspending.- Dialogs and quick UI updates
- Non-critical string retrieval
- When you don’t need reactivity
- Returns immediately from memory cache
- Falls back to database if not in memory
- Returns
"??key??"if string not found - Never blocks the main thread
3. Reactive Flow
Use Kotlin Flow for auto-updating UI when strings change.- Automatically updates when string changes
- Updates when network sync completes
- Lifecycle-aware when used with
lifecycleScope - Perfect for dynamic content
- Content that changes based on user actions
- Status messages and live updates
- Templates with dynamic formatting
- When you want reactive UI updates
Advanced Patterns
Get Multiple Strings at Once
Fetch multiple strings efficiently in a single database query.- Single database query instead of multiple
- More efficient for bulk retrieval
- Returns a
Map<String, String>
String Templates with Formatting
Use string templates with dynamic values. Dashboard String:Preloading Strings for Performance
Preload frequently used strings into memory cache for instant access.- App startup
- Before showing a complex screen with many strings
- After language switching
- Instant string retrieval
- Eliminates database queries
- Reduces perceived lag
Refresh Strings from Network
Manually trigger a network sync to get latest strings.- Fetches latest strings from server
- Updates local database
- Clears memory cache
- Does NOT automatically update UI (call
applyStringbootTags()or refresh your views)
RecyclerView Integration
Using XML Tags in ViewHolder
item_product.xml
ProductAdapter.kt
Using Programmatic Strings in Adapter
Handling Missing Strings
Fallback Behavior
When a string key doesn’t exist, Stringboot returns"??key??":
Provide Default Values
Check if String Exists
Best Practices
Use XML Tags for Static Content
Use XML Tags for Static Content
Use Flows for Dynamic Content
Use Flows for Dynamic Content
Recommended:Avoid:Flows automatically update when content changes.
Preload Before Heavy Screens
Preload Before Heavy Screens
Handle Lifecycle Correctly
Handle Lifecycle Correctly
lifecycleScope which auto-cancels:Use String Templates for Dynamic Data
Use String Templates for Dynamic Data
Dashboard:Code:Avoid:Templates allow you to change format from dashboard.
Common Use Cases
Marketing Campaigns
Update promotional messages instantly without app updates. Dashboard Strings:campaign_banner_title: “50% Off All Items!”campaign_banner_subtitle: “Limited time offer - ends Friday”campaign_cta_button: “Shop Now”
Seasonal Content
Change app content for holidays, events, or seasons.- December: “seasonal_greeting” = “Happy Holidays!”
- January: “seasonal_greeting” = “Happy New Year!”
- Spring: “seasonal_greeting” = “Spring Sale!”
Fix Typos Instantly
Found a typo in production? Fix it immediately from the dashboard. Before:Next Steps
Translations
Add multi-language support and language switching
A/B Testing
Optimize messaging with experiments
Best Practices
Production patterns and optimization
API Reference
StringProvider Methods
| Method | Description | Returns |
|---|---|---|
get(key, lang?, allowNetworkFetch?) | Get string synchronously | String |
getFlow(key, lang?) | Get reactive Flow for string | Flow<String> |
getMultiple(keys, lang?) | Get multiple strings | Map<String, String> |
preloadLanguage(lang, maxStrings?) | Preload strings into cache | Unit |
refreshFromNetwork(lang) | Sync latest strings from server | Boolean |
Extension Methods
| Method | Description | Returns |
|---|---|---|
View.applyStringbootTags() | Apply Stringboot to all tagged child views | Unit |
Troubleshooting
Strings show ??key?? instead of value
Strings show ??key?? instead of value
Causes:
- String key doesn’t exist in dashboard
- Network sync hasn’t happened yet
- String not in cache or database
- Verify key exists in Stringboot Dashboard
- Call
StringProvider.refreshFromNetwork()to sync - Check logs for sync errors
XML tags not working
XML tags not working
UI doesn't update when string changes in dashboard
UI doesn't update when string changes in dashboard
For XML Tags:For Flows:
Flows automatically update—check if Flow is still collecting:
Performance issues with many strings
Performance issues with many strings
Use preloading:Batch retrieve:Avoid:
- Calling
get()in tight loops - Synchronous get() on main thread for many strings