Pergunta

If you highlight a class in Drodio (Android Studio) and mash Ctrl+N, it will show you the inheritance hierarchy for that class, like so for AsyncTask:

enter image description here

This seems to indicate that AsyncTaskLoader inherits from AsyncTaskLoader? Is that so? If so, was that intentional? Or what is going on here?

UPDATE

My bad; I read "Ctrl+N" in the tip where it really says, "Ctrl+H". Here's what you get with the latter:

enter image description here

(though still not just what I expected)

Foi útil?

Solução

Answering this accurately would require knowing more about your project (presumably hhs.app). However, Drodio's hierarchy did discover PersistHistoryAsyncTask, which is a private inner class of ActivityChooserModel, not listed in the Android documentation due to being a private class, so my point on no classes in that android library inheriting from AsyncTask in my original response (below) was incorrect.

Assuming the listed inner classes in RESTfulActivity, SQLiteActivity, MainActivity, and DeliveryItemActivity all extend AsyncTask, the results in your second screenshot are entirely expected. AsyncTask does not inherit from anything (except Object, obviously), and you have 9 classes extending AsyncTask. So, you have the very simple hierarchy:

java.lang.Object
  |
  +-- android.os.AsyncTask
        |
        +-- hhs.app.RESTfulActivity.PostDeliveryItemTask
        |
        +-- hhs.app.SQLiteActivity.FetchAndPopTask
        |
        +-- hhs.app.MainActivity.GetVendorsTask
        |
        +-- hhs.app.DeliveryItemActivity.PostDeliveryItemTask
        |
        +-- etc...

Original Answer:

You're looking at two different classes: android.content.AsyncTaskLoader and android.support.v4.content.AsyncTaskLoader.

The former is an:

Abstract Loader that provides an AsyncTask to do the work.

The latter is a:

Static library support version of the framework's AsyncTaskLoader. Used to write apps that run on platforms prior to Android 3.0.

Both AsyncTaskLoader classes inherit from a class named Loader in their same package, and the two Loader classes inherit from Object. None of the classes in question implement any interfaces.

You can see the source for both classes on grepcode.com:

Neither class is coupled to the other in any way that I can see. The support version imports android.content.Context, but Context doesn't do anything with the AsyncTaskLoader in its own package.

All that said, it does not appear that the feature of Drodio you've posted a screenshot of is intended to be the inheritance tree at all. Rather, it's a class search. You've highlighted AsyncTask, and the search results show 3 other classes which begin with "AsyncTask", 2 classes which end with "AsyncTask", and 1 which begins with "Async" and ends with "Task" (all that in addition to the actual AsyncTask class). Considering AsyncTask does not inherit from any of these classes (AsyncTask doesn't extend or implement anything) nor do any of these classes inherit from AsyncTask (in android.* there are no classes which extend AsyncTask), it seems evident that this feature of Drodio has nothing to do with inheritance.

The fact that Driodo is not displaying your own concrete implementation of AsyncTask seems to be the final nail in the coffin, particular since your cursor is on the very line that defines the subclass. (While not all IDEs can incorporate user-defined functions into documentation pop-ups, most will at least be able to handle things in the same file.)

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top