[Q] Navigating My Activity Hierarchy - Troubleshooting - Android Q&A, Help & Troubleshooting

See the example hierarchy attached. There is a flow up and down. Using the app would go something like this:
Select Team 1 on the Home activity --> Activity A inflates based on the selection.
Select Player 2 on Activity A --> Activity B inflates based on the selection.
Select to Add a Stat on Activity B --> Activity C inflates and allows a stat to be added.
User returns to Activity B, which must maintain the Player 2 context and update based on C.
User returns to Activity A, which must maintain the Team 1 context and updated based on B.
User returns to Home, which must update based on A.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
My question is how to update an activity based on its child while maintaining the context supplied by its parent.
For example, let's focus on Activity B. It knows to inflate for Player 1 because this info was passed from Activity A in an intent.
If I were to go to Activity C and press Back, B wouldn't update.
If I were to go to C and press Up, B would crash because it would try to make a new instance and wouldn't know what player to inflate (defined in onCreate()).
I tried declaring B with a "singleTop" launchMode, but then it just restarts and doesn't update based on C's info. Based on my limited experience/research, I see the following options.
Store an Activity's inflater variables as static (so they won't be "lost" when creating a new instance)
Initiate my view inflation (via Fragment) in the Activity's onStart() method so that it would refresh when Restarting. (Would this help? What about the fact that all of my inflation happens inside of a fragment? I fear the Lifecycle gods.)
I'm new to a lot of this and would appreciate any help. Thanks!

Related

[Q] Need A simple app made, who wants a project?

OK, this app has 4 pages but pull in information from a url/api so some data will need to be save by the user and then displayed in a table.
The data is given in json or xml or csv.
I will show a picture and then say what each page is.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Page 1: this is where the use will have to save their API, and link to how to find their API page
Should show the first time or when changing their API
Page 2:
Pick Date: will by default be the past 7 days, but allow them to pick what ever days the want
Chart: this is what the information that needs pulled it, using a url with the api code and dates
Page 3: Just shows what I want in a menu
Page 4: is the page that tells someone how to find there API
ADDED: The ads (why did I put add?) lol I want this to be a simple thing that will show 3 ads and link to where ever I want.
I need the frame work built, and coding done. I will do the images and icons, ad banners
------------------------------
The url for the api to get the information looks like this
http://this-website.com/stats/stats...art_date=2012-05-01&end_date=2012-05-08&group[]=Stat.date
You will see:
1: /stats.xml (pick cvs, xlm or json)
2: api_key=AFF2rkPVl33rgoh37fON2dd5Nov2nk5d (saved by user)
3:&start_date=2012-05-01&end_date=2012-05-08 (for the dates)
Who can get this going for me? And what is it going to cost?
Hoping for some better luck, I would still love to have this app made. Give me a fair price for your time!

[Q] How do you explain non-obvious features of your app to your users?

I just published v1.0 of a text adventure interpreter (sideload url - for those who don't have access to google play). Here is a screenshot of the main user interface:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
My problem now is that I got a few control features in it, that you might stumble upon by accident, but from which it is not immediatly obvious that they exist at all. These controls are not vital, but make life a lot more compfortable. To list them:
You can swipe the message area left/right to get to the status screen (same as pressing the "flip view" button)
touching a word in a chatbubble will automatically copy it to the input prompt. Double tapping empty space will clear the input prompt
The icons in the lower bar are "speeddials" and fully customizeable. You open the editor by long pressing the icon.
In itself, those controls are pretty sane as they allow you to do things fast. They are what a power user would want to be there, but how do I explain their existence/usage to the casual user? My first idea naturally was to put that in the FAQ, but who reads docs these days? The next idea I had was to simply pop up a messagedialog when the user first comes into the vicinity of a control (e.g. touching a speeddial pops up an alert dialog telling the user how to edit it). Personally, I hate "nanny dialogs" and could see that as a reason to uninstall. Next idea was to display a toast but showing a timed message somehow seems like the wrong approach. Final idea was to push instructions to the notification bar. Not as disruptive as a dialog, but a lot of people seem to care religiously about the notification tray to be empty.
So ... any good ideas on the matter?

Resolving HTTP 502 Error During Leaderboard API Calls

Symptom:
When the getRankingIntent API is called, which is related to leaderboards, the following error message is displayed.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Log Information
The following error information is displayed in the Android Studio Logcat logs:
HTML:
2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant W/HwGameAssistant-10.6.0.301-RequestHelper: client.assistant.gs.leaderboard.scores reponse fail code:502, msg:Bad Gateway
2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant E/HwGameAssistant-10.6.0.301-GameRankingScoreListViewModel: getHttpStatusCode is : 502
Troubleshooting
The test result shows that the game sign-in function is normal. Therefore, the problem is not caused by a network error. After studying relevant documents, we checked the following items:
1. First, we ensured that the package name and app ID belong to the same game.
2. Then, we checked whether leaderboards have been created for the game in HUAWEI AppGallery Connect. It was found that leaderboards have been added for another game. We attempted to resolve the problem. However, testing shows that the problem still persists.
3. Finally, it was found that the account we used for testing is not on the list of test accounts in AppGallery Connect. After adding it to the list and clearing HMS Core (APK) cache on the phone, the problem is solved.
Summary:
If you find that the leaderboard function is abnormal, ensure that:
The app ID and the package name belong to the same game.
Your game has its leaderboard data created in AppGallery Connect.
Your test account has been added in AppGallery Connect.
For more details, check:
Adding a Leaderboard:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-add_leaderboard
Managing Tester Accounts:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-tester_account_mgt

Resolving HTTP 502 Error During Leaderboard API Calls

Symptom:
When the getRankingIntent API is called, which is related to leaderboards, the following error message is displayed.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Log Information
The following error information is displayed in the Android Studio Logcat logs:
2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant W/HwGameAssistant-10.6.0.301-RequestHelper: client.assistant.gs.leaderboard.scores reponse fail code:502, msg:Bad Gateway
2020-10-22 11:14:17.831 27218-3850/com.huawei.gameassistant E/HwGameAssistant-10.6.0.301-GameRankingScoreListViewModel: getHttpStatusCode is : 502
Troubleshooting
The test result shows that the game sign-in function is normal. Therefore, the problem is not caused by a network error. After studying relevant documents, we checked the following items:
1. First, we ensured that the package name and app ID belong to the same game.
2. Then, we checked whether leaderboards have been created for the game in HUAWEI AppGallery Connect. It was found that leaderboards have been added for another game. We attempted to resolve the problem. However, testing shows that the problem still persists.
3. Finally, it was found that the account we used for testing is not on the list of test accounts in AppGallery Connect. After adding it to the list and clearing HMS Core (APK) cache on the phone, the problem is solved.
Summary:
If you find that the leaderboard function is abnormal, ensure that:
The app ID and the package name belong to the same game.
Your game has its leaderboard data created in AppGallery Connect.
Your test account has been added in AppGallery Connect.
For more details, check:
Adding a Leaderboard:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-add_leaderboard
Managing Tester Accounts:
https://developer.huawei.com/consumer/en/doc/distribution/app/agc-tester_account_mgt

Error When Web Components Send a Message to an HTML5 Page

What Happened?​When Web Components send a message to an HTML5 page, the following JS error is reported:
02–14 09:22:56.329 E/jsLog (18834): [H5]Uncaught TypeError: system.onmessage is not a function
Why Did It Happen?
If the system.onmessage function defined in an HTML5 page involves a large amount of logic, the function may reference external JavaScript libraries, for example, jQuery. In this case, if Web Componets trigger this.$element(‘webElementId’).postMessage({message:’xxx’}) in the function for handling onpagefinish events, referenced JavaScript libraries may fail to load fully. As a result, the error “system.onmessage is not a function” is reported.
How to Resolve the Problem?
Ensure that the system.onmessage function in the HTML5 page only contains the necessary logic, that is, receiving data transmitted from a quick app page. You can leave other logic, for example, handling onload events, to lifecyle functions of the HTML5 page for processing.
Note that data from the quick app is not received once the onload event is triggered. In this case, the HTML5 page needs to listen to data receiving in polling mode. To achieve this, refer to the following sample code.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
The following code is not recommended.
Suggestions and Summary​You should understand the mechanism for sending messages between a quick app and an HTML5 page. Then use the polling mode to solve the asynchronous data transmission problem.

Categories

Resources