methodName().methodName2()??
This must be a simple question to many people on this forum... but i'm here scratching my head...
This line was taken from Android sample project (NotesList) onCreate() method...
Cursor cursor = managedQuery(getIntent().getData(), PROJECTION,
null, null, NoteColumns.DEFAULT_SORT_ORDER);
I understand calling methods by their respective class name and method name as so:
someClass.someMethod();
but I can't quite grasp this idea where you call method().method2()...
can someone please explain what is expected when you call methods like this?
do i expect to get some return value from the first method and that value to be passed on to the next method?
Thanks in advance ;)
Re: methodName().methodName2()??
method().method2()
The first method: method() would return an instance of a class with a method: method2
Read the API doc for method() to see what it returns.
If you coded it in two statements it might be clearer:
AClass anObject = method();
anObject.method2();
Re: methodName().methodName2()??
Thank you for your response!
I went on and posted in another forum with same question and I've gotten a fairly simple but to the bullet answer.
The user told me this is called 'method chaining'. So, I went on and googled.
And with your explanation on top of what I found, i've got a good understanding.
Thank you again and hope this helps some ppl out there. ;)
Re: methodName().methodName2()??
It's good manners to post links to other threads where you have posted the same question. Then all can see the various answers and save time making an answer if that answer has already been posted on the other forum.
Re: methodName().methodName2()??