Search app shows a blank screen


#1

Hi,

I’m an iPhone user/developer trying to learn Android. The sample app for chapter 28 presents me a blank screen on my new HTC One running Kitkat. I get the same behavior in the emulator. I also expected that the return key would initiate search, but since nothing happens, I’m not sure I’m guessing correctly about how the search UI is supposed to function.


#2

Same here. Also after implementing SearchView my app crashes with a NullPointerException. This line causes the problem:

searchView.setSearchableInfo(searchInfo);


#3

Fixed everything:

app:actionViewClass=“android.widget.SearchView”/>

instead of

android:actionViewClass=“android.widget.SearchView”/>


#4

Yes, app:actionViewClass instead of android:actionViewClass fixed that null pointer exception for me too.

Don’t forget to define the app namespace on the menu element as xmlns:app=“http://schemas.android.com/apk/res-auto”. (keep the android namespace also obviously)


#5

I had the same problem. I realized that the solution code had

in FlickrFetchr.java, so I needed to put my API key in. Another important thing to note is that FlickrFetchr.java also has

which needs to be updated to

with https. After I made these changes it worked! :slight_smile: