Solved

Java question regarding abstract method implementation

Posted on 2011-03-20
6
470 Views
Last Modified: 2012-06-21
Hi experts,

I was referring some open source java code of android. In one of the classes, I saw a method call to another class. The method called was an abstract method inside an abstract class. As is expected, the abstract method do not have any implementation. But, to my wonder, this abstract method returns a List. I do not know, without having any implementation(and return statement) for a method, how this method returns a List?

Please refer the code attached.

Any help in this regard would be appreciated.

Best Regards,
Sreejith
// Calling Method

final List<ResolveInfo> apps = manager.queryIntentActivities(mainIntent, 0);

//Called Method inside another abstract class

public abstract List<ResolveInfo> queryIntentActivities(Intent intent,
            int flags);

Open in new window

0
Comment
Question by:Sreejith22
  • 3
  • 2
6 Comments
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 35178480
The implementation would be in a subclass of the abstract class
0
 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
ID: 35178482
though you shouldn't generally need to see the implementation

http://download.oracle.com/javase/tutorial/java/IandI/abstract.html
0
 

Author Comment

by:Sreejith22
ID: 35179350
Hi Objects,

Thanks for your reply. I found out the sub class  of this abstract class which has this method. When I provided a log inside this method, I found out that, this method is being called 5 times, while I was just expecting a single call.

Is there any method by which, I can identify the class(or method), from which this method is called, by providing a log inside called method?
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 92

Assisted Solution

by:objects
objects earned 250 total points
ID: 35179407
0
 
LVL 4

Expert Comment

by:msk_apk
ID: 35180092
when you call ,

final List<ResolveInfo> apps = manager.queryIntentActivities(mainIntent, 0);

manager must be pointing to the object in which the method queryIntentActivities is implemented.
0
 

Author Closing Comment

by:Sreejith22
ID: 35204462
Thanks objects!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

A short article about problems I had with the new location API and permissions in Marshmallow
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This video teaches viewers about errors in exception handling.
This video is in connection to the article "The case of a missing mobile phone (https://www.experts-exchange.com/articles/28474/The-Case-of-a-Missing-Mobile-Phone.html)". It will help one to understand clearly the steps to track a lost android phone.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now