1

So i update to the last v0.8 and it seems i get errors on the android.annotation.TargetApi import. It seems this belongs to the Api level 16 which isnt out yet. Or is there some package to get this?

regards,

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
Maxrunner
  • 1,955
  • 4
  • 24
  • 41

1 Answers1

4

First, API Level 16 has been out for not quite two weeks.

Second, @TargetApi has been around for at least a couple of months. Make sure that you are on a fairly current version of the Android developer tools (at least R17), as this is more of a tools issue than a build target issue AFAIK.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Ok,in the Android SDK manager i dont see the Android Api 16 to download for some reason. Still let me check more on this, ill try to confirm later. Thanks – Maxrunner Jul 10 '12 at 11:20
  • @Maxrunner: "in the Android SDK manager i dont see the Android Api 16 to download for some reason" -- you will need to download and install the R20 tools to get the API Level 16 SDK download options. – CommonsWare Jul 10 '12 at 11:31
  • In a complete different topic, do you know easily, how can i turn on the auto loading if i have the onException method returning false. Lets say another event happens i want the endlesspater to restart trying to load the list? – Maxrunner Jul 10 '12 at 16:21
  • @Maxrunner: I have no idea what you are talking about, sorry. – CommonsWare Jul 10 '12 at 16:43
  • Right now the onException returns false, so that means it will stop fetching data for the list if an exception occurs. But is there a way to change this at a later time. – Maxrunner Jul 10 '12 at 17:04
  • @Maxrunner: "But is there a way to change this at a later time." -- `onException()` is called for each exception that occurs. If a later exception you want to handle differently than an earlier one, that's up to you in your `onException()` implementation. – CommonsWare Jul 10 '12 at 17:09
  • I have the endlessadapter working with a pull to refresh view, and the problem is this. If there's an exception it will stop the cacheInBackground from keep trying to get the data, which makes sense. But i have a pull-to-refresh view as a listview, and if i try to load the list with the pull to refresh method, it will add the items correctly, but when i reach the end of the list, the loading row from endless adapter wont appear and try to load whatever it needs to load. Basically im trying to sychronize the endlessadapter to the pull to refresh implementation. – Maxrunner Jul 10 '12 at 17:25
  • @Maxrunner: "the loading row from endless adapter wont appear and try to load whatever it needs to load" -- it should, if you returned `true` from `onException()`. If you are saying you returned `false` before and later on are changing your mind... `EndlessAdapter` does not presently support that. You could experiment with adding a `restartAppending()` method or some such that sets `keepOnAppending` to `true`. If that seems to solve your problem, let me know and I'll consider adding it to the official copy. – CommonsWare Jul 10 '12 at 22:14
  • Hi, Mark! it worked, i added the method just like you said and it will restart adding when i reach the end of the list. With this, if there's an exception, like say, for putting a badly formatted url for a httprequest, the onException will give the exception and stop. Now, the person will fix this, and pull-to-refresh the list, and if it returns new data, you call the method restartAppending(), and the list "keepOnAppendin" when we reach the end of it. Thanks. – Maxrunner Jul 11 '12 at 08:55
  • @Maxrunner: I have added an issue to track this feature request: https://github.com/commonsguy/cwac-endless/issues/10 It will probably be a couple of weeks before I push this out. – CommonsWare Jul 11 '12 at 09:31
  • @CommonsWare: I am attempting to use TargetApi as described in http://stackoverflow.com/questions/12232237/android-eclipse-lint-api-checks without success. ADT version is current (20.0.3), but TargetApi is not recognized (generates errors itself). Any ideas? – Dave Sep 09 '12 at 20:43