Norm Radder

Master Rancher
+ Follow
since Aug 10, 2005
Merit badge: grant badges
Biography
Worked mostly with IBM mainframe assembly code. Loved IBM's VM OS.
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Norm Radder

The tutor mostly removed places where the code saved the GUI values.  

Interesting that not saving (and restoring) values allowed the code to work.  How are the values saved across invocations of the app?    I haven't looked at the code yet,  May be it will be shown there.
Can you also copy and paste here the logcat contents that shows what the values of variables are and when?

I see the code is still using String literals as keys instead of a String constant.
4 days ago

wouldn't it be: 00011010? A different value from the 00110100?


You are right.  I didn't look close enough.  The values shown in the image are wrong.
5 days ago

what exactly does "& 0xFF" do?


It it sets all the bits in the target variable to 0 except for  low order 8 bits.  
For example If the variable held (in hex) 123C and it was ANDed with FF the result would be 003C

The last 3 lines in the posted image shows an example.
5 days ago

He made several changes to the code.   I tested that I can close and open the app two times and the values stick.


What was changed so that the program was able to keep track of the previously set values?
5 days ago
My environment does not support colors.  Sounds nice, but I have no idea how to preserve the colors.

I use batch files to call the adb command with a full path.  The >> concatenates the output to the designated file:


@rem  Run adb

D:\AndroidDevelopment\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe devices

D:\AndroidDevelopment\adt-bundle-windows-x86_64-20140702\sdk\platform-tools\adb.exe logcat >> Nexus7Logcat.txt

MORE


That is with the android device connect to my PC with a USB cable.  The adb command does not end so I let it run a while and then close the window or use the Task Manager to End Task on the adb command.
1 week ago

I'm a little frustrated with not being able to get the code to work,

It is rare that a program works early on.  There is always something that you didn't think of.  I think in 50 years of programming I have  had 3 programs that I designed, coded, typed in the code, compiled and executed with the desired results the first time.
Now you are into the debugging phase.  I have used interactive debugging with a C++ project and it is nice for complicated programs. But with java I use print statements that write to a log file that can be read to understand what is happening.  You have Log statements that write to the logcat.  I haven't used the filtering that a fancy IDE provides.  I use the adb command to pull off the logcat and get a 20-30M file to read.  When debugging the IBM VM OS in the 80s, I used to get a core dump on paper that measured in inches.  Today everything has  programs to help scan a dump.

FWIW Here is a sample of the print out from a program I am currently debugging ( BLW = BatteryLevelWarning)  I like to keep the text short so I abbreviate a lot.


BLW onCreate() at 2025-01-30 T 10:19:26
BLW onCreate  times=07:15, 10:00, 15:00, 15:30, 16:00, 16:30, 17:00, 17:30, 18:00, 21:45
BLW onCreate() intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.normsstuff.batterylevelwarning/.BatteryLevelWarning bnds=[696,761][888,999] }
>>data=null
>>extras=null
savedInstanceState=null
BLW onResume at 2025-01-30 T 10:19:27
BLW button clicked runningAlarm=false, alarmPI=null at 2025-01-30 T 10:19:32
BLW Set the alarm for 60 seconds at 2025-01-30 T 10:19:32 alarm at Jan 30 10:20
BLW onPause() at 2025-01-30 T 10:19:34
onPause intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.normsstuff.batterylevelwarning/.BatteryLevelWarning bnds=[696,761][888,999] }
BLW onDestroy at 2025-01-30 T 10:19:34
   1 minute
BLW onCreate() at 2025-01-30 T 10:20:38
BLW onCreate  times=07:15, 10:00, 15:00, 15:30, 16:00, 16:30, 17:00, 17:30, 18:00, 21:45
BLW onCreate() intent=Intent { flg=0x10000000 cmp=com.normsstuff.batterylevelwarning/.BatteryLevelWarning (has extras) }
>>data=null
>>extras=Bundle[mParcelledData.dataSize=132]
savedInstanceState=null
>>bndl keySet=[timeOfAlarm, StartedBy]
BLW startedBy=OnAlarmReceive, timeOfAlarm=Jan 30 10:20 at 2025-01-30 T 10:20:38  <<<<<<<<<<<<< NOTE
Battery level=89
BLW Set the alarm for 60 seconds at 2025-01-30 T 10:20:38 alarm at Jan 30 10:21

  ??? 10 minutes later <<<<<<<<<<<<<<  Manually opened
BLW onResume at 2025-01-30 T 10:30:24
BLW onPause() at 2025-01-30 T 10:30:24
onPause intent=Intent { flg=0x10000000 cmp=com.normsstuff.batterylevelwarning/.BatteryLevelWarning (has extras) }
BLW onSaveInstanceState() at 2025-01-30 T 10:30:24
BLW onResume at 2025-01-30 T 10:30:24
BLW TTS onInit status=0
BLW runnable calling finish() at 2025-01-30 T 10:30:30
BLW onPause() at 2025-01-30 T 10:30:30
onPause intent=Intent { flg=0x10000000 cmp=com.normsstuff.batterylevelwarning/.BatteryLevelWarning (has extras) }
BLW onDestroy at 2025-01-30 T 10:30:30

BLW onCreate() at 2025-01-30 T 10:30:33
BLW onCreate  times=07:15, 10:00, 15:00, 15:30, 16:00, 16:30, 17:00, 17:30, 18:00, 21:45
BLW onCreate() intent=Intent { flg=0x10000000 cmp=com.normsstuff.batterylevelwarning/.BatteryLevelWarning (has extras) }
>>data=null
>>extras=Bundle[mParcelledData.dataSize=132]
savedInstanceState=null
>>bndl keySet=[timeOfAlarm, StartedBy]
BLW startedBy=OnAlarmReceive, timeOfAlarm=Jan 30 10:21 at 2025-01-30 T 10:30:33  <<<<<<< NOTE timeOfAlarm is 9 minutes ago
Battery level=89
BLW Set the alarm for 60 seconds at 2025-01-30 T 10:30:34 alarm at Jan 30 10:31
BLW onResume at 2025-01-30 T 10:30:34
BLW TTS onInit status=0
BLW runnable calling finish() at 2025-01-30 T 10:30:40
BLW onPause() at 2025-01-30 T 10:30:40
onPause intent=Intent { flg=0x10000000 cmp=com.normsstuff.batterylevelwarning/.BatteryLevelWarning (has extras) }
BLW onDestroy at 2025-01-30 T 10:30:40

BLW onCreate() at 2025-01-30 T 10:30:54
BLW onCreate  times=07:15, 10:00, 15:00, 15:30, 16:00, 16:30, 17:00, 17:30, 18:00, 21:45
BLW onCreate() intent=Intent { flg=0x10000000 cmp=com.normsstuff.batterylevelwarning/.BatteryLevelWarning (has extras) }
>>data=null
>>extras=Bundle[mParcelledData.dataSize=80]
savedInstanceState=null
>>bndl keySet=[Notify at]
BLW startedBy=null, timeOfAlarm=null at 2025-01-30 T 10:30:54
BLW onResume at 2025-01-30 T 10:30:54
BLW button clicked runningAlarm=true, alarmPI=null at 2025-01-30 T 10:30:55
BLW cancelled Alarm at 2025-01-30 T 10:30:55
BLW onPause() at 2025-01-30 T 10:30:58
onPause intent=Intent { flg=0x10000000 cmp=com.normsstuff.batterylevelwarning/.BatteryLevelWarning (has extras) }
BLW onDestroy at 2025-01-30 T 10:30:58

1 week ago
Can you copy the contents of the logcat and paste it here that shows the problem?  Add some comments to it to point out where you think the values aren't what you want.  A good printout of values as the code executes helps me to understand the problem.

A suggestion on coding style:  Don't use String literals as keys for the put... and get... methods.  Instead define a String constant.
For example:

vs

That way the compiler will catch typos.  The compiler will not catch mistyped Strings:


1 week ago

01/29/2025  09:07 AM               157 HelloWorld.java.txt


You probably saw  HelloWorld.java in the file explorer program.
I suggest you change the default settings for the Windows file explorer program to show a file's extension.  File explorer will hide the common extensions so you can miss the real extension
1 week ago
I solved the missing menu item.  I missed copying the values-v14 folder from the eclipse project's res folder to AS's.  It contained a styles.xml file with:

Now I can get back to programming - fixing bugs and adding features.  However AS is so SSSLLLOOOOOWWW that I will stay on eclipse until I need some features that are only available on AS>
1 week ago
If you are in the packageb folder,  the javac command needs a way to find the packagea folder.  I believe the -cp option can do that. For example:
javac -cp <path-to-folder-holding-packagea> ClassB.java
1 week ago
Migrating an Android project from eclipse to Android Studio
I am in the process of doing my first migration.  Tim Holloway migrated a project for me earlier on, so I thought I should continue the momentum and try to do one on my own.  I initially tried to open several projects that I had downloaded from the internet.  They all had the folder structure and gradle files that I thought would be picked up by Android Studio.  I was not able to get any one of them to be imported into AS without at least a half dozen errors due to compatibility, missing libraries, wrong statements, etc.  Too much for a beginner.
So I tried another approach.  I created a new Empty Activity and manually copied into it the files and folders from the eclipse project.  With a few minor changes (solutions mainly from SO) I was able to get it to compile and execute.   However the apk's size was 5MB vs 120KB on eclipse.  Looking at the apk file using AS's analyzer I saw it had 5MB of classes in the androidx package.  My code does not use androidx.  I manually removed from the gradle files all references to androidx and junit.  Also I added some statements to a gradle file asking for a smaller apk.  Had a few problems with syntax differences between Googy and Koitlin versions of Gradle. AS acccept the changes and now the apk is 33KB.  Also I needed to find how to cause AS to sign the apk so it can be installed on a device.  Done.  I am able to install the apk on a virtual device.
I was surprised how lenient AS was to allow me to copy in files and delete files.

However the app has lost its menu list (accessed via 3 vertical dots on taskbar).  That is the next issue to resolve.
Also AS forced me to use higher versions of the API 33 vs 24.  I would like to remove that restriction and go back to 24.

1 week ago
The getConnection() method can return the same Connection object to multiple callers.  Is there some state in the object that would cause the future uses of it to fail.

Is Connector a class?  What package is it in?
What statement in your code was executing when the exception happened?  That should show in the stack trace.

I can't start eclipse photon using jdk 17  


What error messages do you get?   To see error messages, open a command prompt window in the folder with the eclipse command and enter the eclipse command.

jdk 17 (specified in eclipse .ini).


What is the content of your ini file?
2 weeks ago