Inconsistency in code and cannot use the pre-made codes


#1

I got as far as figure 9.10 and then noticed that the code shown for CrimeListFragment is not consistent with how it was several pages before when it was last edited. I couldn’t get the public void onListItemClick method to work and the @Override kept saying that it’s in the wrong place. I eventually got frustrated and decided to replace my code with the finished solutions folder for chapter 9. Eclipse shows no errors but when I build and run on my device or virtual device, it crashes and states that the CrimeListActivity class cannot be found. I tried to load the chapter 10 project as well and it has the same problem.

Help please!


#2

1- Do you mean listing 9.10? Listing 9.10 is a brand new class, so I’m not clear on what it’s not consistent with.

2- I’ve just verified that the Chapter 9 solution works, so you must be experiencing a problem on your end. How are you importing the project into Eclipse? You should make sure to select “Import existing projects into eclipse” when importing.

Another thing you might try: go to Project->Clean… and clean your project. Also: make sure Project->Build Automatically has a check mark next to it.


#3

Hi starmate,

I had the same problem because I had placed misstakenly a closing braket after the getView(…) class. Notice that getView(…) must rely inside the class CrimeAdapter.

I had to compare my CrimeListFragment.java with the solution to realize that, and then it worked wonderfully.

Great job with this book guys, it’s too much information together but you make a very good work explaining.

Regards,


#4

Thanks, al3jandrus. :slight_smile: