TextView participant_id_tv = (TextView )new_participant_view.findViewById(R.id.patient_id);
participant_id_tv.setText(participant_id); //this is the line that caused the above exception.

At the beginning, I was thinking it’s because participant_id_tv is null. but after looking at my laoyout file, R.id.patient_id is clearly a valid resource id, with <TextView android:id=”@+id/patient_id”…./>

It turns out it’s because when I pass an integer to setText, android thinks I am passing a resource id and tries to find resource. what I need is to explicitly convert int to String as below:

Now swipe works in the presence of scrollview. however, i found another issue.

Problem 2: button & spinner can not be selected.

This problem doesn’t show up when the dispatchTouchEvent() method is not overrided as code above. so how to solve this problem? what I did is to change the last line “return true” to “return false” in onDown, onTouchEvent and onScroll method in which “return true” is the default last (or only) line code in the method.

when I swipe, I found onDown is first called, then onScroll, last onFling. when nothing is done in those code, we should make them return false. Returning true “means” that the event has been consumed, and is therefore not passed on.

if the event is dealt in the current method, then return true, meaning the event is consumed, so no need to pass it on to child views;
Otherwise, return false so the event can be passed on to child views.

First, I need to install USB driver for the tablet. When I plugged it in, it shows fail to find the android usb driver for ADB(Android Debug Bridge). At this time, my Eclipse can’t find the device, and neither abc. when I call “abc devices” command line, it shows no attached device. For samsung tablet, I went to samsung website to install ADB driver. it turns out I have to install Kies from Samsung and this will install ADB driver for me. I couldn’t find independent ADB driver. Now, “adb devices” on command line will show a device connected. the number shown doesn’t make sense though. Note: on command line, first need to go to the folder of android-sdk/platform-tools/, then call adb devices.

Then, I turn the debugging mode on by Developer options->USB debugging mode

Now, in Eclipse, I run my application as usual, only to set “Run configuration”->Target->Launch on all compatible devices/avd->active devices.

Now the app is installed to the tablet. As long as the cable is connected between the tablet and the computer, I can compile and run the app on tablet which is faster than when running on emulator. awesome!

However, I had an issue in this whole afternoon and evening. I keep running into “null pointer” error when I click on some of elements in the questionnaire, or when I try to open an activity( in my case, questionnaire activity). and I thought maybe it’s because Samsung use different library . so I changed some elements name, or changed the way of implementing the style of spinner (set android:entries=”@array/**” instead dynamically customize it in onCreate(). all the errors are still there. they are all caused by findViewById() can’t find the element. and I couldn’t find a pattern for what elements may go wrong. At first, i thought maybe it’s because I set some element to be android:visibility=”gone” in the xml file, and findViewById() can’t find it under Samsung library or what.

Guess what, it’s all because I created layout files of QuestionnaireActivity for different densities, but I didn’t update the version for xhdpi. I only update for mdpi (layout folder without any prefix). But this tablet is xhdpi. thus, it is using the old layout file that doesn’t have all the elements.

This is a popular behavior question in interviews. But recently I have been asking myself this question a lot. every time I need to kill my time, I will start thinking about this question. I definitely want to stay employed after five years. but what direction do I want my career be heading towards at that time? Or, what do I want most in my career?

Honestly, never really thought about this seriously before. Most of the time, I just follow the main stream and here I am now. lucky enough, I am in a not bad position at this time. After 1 year and a half confusing time in PH.D. program I decided to quit the PH.D. and get a master degree only. Now, there are 6 more months to get my master degree in computer science for which I didn’t pay a penny for, instead I actually made some bucks out of it; And I have one job offer in California at hand long before graduation. Yet when I look back, I realize how much different this is from what I pictured myself when I was a senior in college preparing for GRE and applying to US schools.

At the end of my college, I got two master offer with full support, and several other PHD offers. and I chose PHD offer. I still remember one school who gave me a master offer with fellowship, Fordham University. The professor who gave an interview to me was suggesting I should take the master offer for now, and later on I can decide if I still want to go PH.D. That’s the same suggestions I got from some other people I met on Internet. However, at that time, I thought I am determined to go for PH.D. if anyhow I will go to PH.D., why would I bother to get a master at first? Isn’t that a waste of time?

Now, I can’t help thinking about that decision I have made. It’s hard to see what’s gonna happen if a different road was taken. but it’s apparently these kind of decisions do have a big impact of our lives.

so I feel so confused about the future. it’s uncontrollable and can’t be planned. some one will tell me, “that’s why you need to follow your heart, so you will feel happy at least”. I would agree with this. but unfortunately I just cant tell what my heart is telling me to do. Even I hear something in my heart, I will think is this good? am I just finding excuses for not choosing the difficult path which more people like better? or do I really know that’s what I want? Or I will ask myself, is this difficult path worth it?

I will fall back, flinch, retreat. and so I don’t get to test what’s my heart telling me to do.