Summary of the development of SMS reading software (2)

xiaoxiao2021-03-06  50

04-12-13 17:52 The software read by the SMS is finally able to run normally, and the ME also touches the SMS storage format mechanism of the backup file. But watching the program that can complete the read SMS task, the more uncomfortable, so messy, what Dongdong is entangled, the main program has more than 600 rows. This can also be seen that ME has no software design (sweat ^ _ ^), completely follows, where is the problem test, think about what, 咿, 咿, true!

Combined with reading Thinking in Java a little bit of feelings from the master, Java's power originated from object-oriented, but me only used it as a coded tool, it was too regrettable. Therefore, the reconstructed procedure is determined, and the object is redesigned according to the object-oriented idea. Not so supercompere, ME has to seek truth from facts, make SMS make a class, backup files, and run the main program, and format the auxiliary class that formats the log display. The members of the SMS are well set, which is the time, content, contact, etc., the method is designed to determine whether the buffer is SMS content and the critical read qualified buffer setting member value. The backup file class is a backup file that the input file is judged whether or not the member has a text message, and the internal variables such as file pointers, and the like. Although it is not very high, he said that ME is also an object. So starting to transfer the correct backup file, SMS format logic. A copy, paste, Huoho, get it. Compile, package, and run. Halo, out a bunch of misunderstandings, the number of SMS is far below the actual quantity!

I set a fixed god. In the error, it seems that there is a Hashset statement, it can be seen that the problem of adding the SMS to SMS collection. Review the prompt of the error in detail, the most in the middle of the SMSELEMENT class is overloaded. The error trajectory is about this: comparison when adding smselement to HashSet (This set does not allow repeated elements to exist, so add new time to determine if there is already existing), then call Equals in smSelement, involving Hashcode. Check the source code, and you can't find the problem. In the original program, because all functions are set in a code file, it is very convenient to set the debug information. For example, if the file reads it, you can display it, but split a few After a class, it is more troublesome, so ME cannot pass the file pointer into a child class. If you display the address every time, it is too troublesome, who knows what time is wrong? ! Complaints, returning, debugging is also available. After running a few times, slowly feel the problem should be in the SMS construction, which means that the Member Member of SMS has not all set it. It is added to the set. When comparing, it is time to generate a Hashcode, an error occurred while the NULL operation . Take test, huh, huh, it's true.

Is there why text messages have not been fully set up? It is definitely a problem with the reading process. Targeted setup debug statement, huh, grab, the problem is wrong with the SMS reading of multiple blocks. Check the SMS transmit and receive logo, the wrong rather, not the ME will appear normally when you use the HEX method to check the backup file. Looking again, it is wrong, and each time I read is the last piece of multiple blocks. It is another nuclear pair, test, finally discovered the problem: ME passed the block's pointer to the method of reading multiple pages, can't transfer the original pointer correctly! There is no way, and now you can't consider the independence between the modules, set a global variable to point to blocks, OK, and the problem is solved. The card is here to stay up all night, really is not willing. Sorry, see where the base card is. Find a lot of articles in the online use of Google Search "Java Parameters". After learning, I will understand that all parameter passes in Java is passed by value. The article was then posted. Basic concept is not a thoroughness. keep it up!

转载请注明原文地址:https://www.9cbs.com/read-81101.html

New Post(0)