Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Java question regarding abstract method implementation

Posted on 2011-03-20
6
Medium Priority
?
510 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 92

Accepted Solution

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

Assisted Solution

by:objects
objects earned 1000 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 92

Assisted Solution

by:objects
objects earned 1000 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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your app took Google’s lash recently, here are the 5 most likely reasons.
In this post we will learn different types of Android Layout and some basics of an Android App.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

609 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