Android Week7 HW

I can’t believe time flies so fast! It is already week 7, which means there is only one more week left of the android workshop! Time to get the gears moving and the app working! My first task was to figure out why the app on the receiver side was crashing. This is when logs come in handy. I put logs everywhere so I can understand how the code is functioning and I found out that it crashes right before the receiver tries to open it. This clearly means that the receiver is trying to open something that either doesn’t exist or is damaged somehow. After thoroughly debugging my app, I found out that the intent was setting two types of data in different places, so I was sending some weird unrecognizable file instead of a .txt file. This problem involved me changing a lot of code which would obviously be error prone, so I decided to drop the idea of sending a .txt file and simply create a new .txt file on the receiver side and populate it there. So the first thing I had to do was retrieve the contents of the sticky note and store it in an intent, which I then passed it to the other device. The other device then reads the intent and gets the contents and stores it in a variable. I then created a new .txt file on the other device, populated it using the content from the intent it received, and then opened it in full window mode with an option to edit the sticky, since by default it is opened in a non editable screen.

stickySent_screenshottitleError_screenshot

 

I was able to successfully get the contents but the title was messed up! Since the creation of the title was taking place in another thread, there was no way for me to send the title through an intent, so thats why the default title shows up. I tried everything I could possibly think of, but there is just no way for the two threads to meet exactly where I want it to. Now that I have the foundation laid down, I can work on the minor details such as adding a save function, adding a way to retain the color of the original sticky note, fixing the title, and of course a way to send it back, since so far the communication is unidirectional. So on to the week 8, where everything comes together!

Skip to toolbar