Bug 5988 - Fragments Walkthrough expected behavior different from actual behavior (autocomplete)
Summary: Fragments Walkthrough expected behavior different from actual behavior (autoc...
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 3.0.x
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: Tom Opgenorth
URL:
Depends on:
Blocks:
 
Reported: 2012-07-05 12:17 UTC by Nischal
Modified: 2012-12-18 09:54 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Nischal 2012-07-05 12:17:32 UTC
Steps to reproduce this issue:
1. Open link http://docs.xamarin.com/android/tutorials/Fragments_Walkthrough/Part_1_-_Walkthrough
2. Create Android Fragment as per step four(4. Create the TitlesFragment
) in document.
3. Change the class so that it inherits from Andorid.App.ListFragment

Actual result:
ListFragment not appears in autocomplete popup after typing Android.App. in android fragment file.

Expected result: List fragment should appear after typing Android.App. in Android Fragment file.

Environment:
Windows and Mac
MD 3.0.3.3 RC3 
MFA 4.2.4 RC2

Regression Status:
NOT A REGRESSION: This is happening on MD 3.0.3.2 and MFA 4.2.3
Comment 1 PJ 2012-07-12 16:52:10 UTC
Please check very carefully to make sure you are following the exact instructions, and then report on whether or not this issue:

a) still exists
b) prevents the user from building the project



Not sure if this tutorial needs updating or if this is a bug.
Comment 2 Nischal 2012-07-13 07:41:52 UTC
This issue still exists. 

This issue is blocking user from building the project.

However, When rename the Activity1.cs file to MainActivity.cs Class and file name gets changed but it does not inherits  form FragmentActivity, it gives the error "/Users/imac/Projects/FragmentSample/FragmentSample/MainActivity.cs(37,37): Error CS0246: The type or namespace name `FragmentActivity' could not be found. Are you missing a using directive or an assembly reference? (CS0246) (FragmentSample)"

It seems that tutorial needs some updation with more clear steps in each section.
Comment 3 Tom Opgenorth 2012-07-13 10:25:26 UTC
In step #1, MainActivity should inherit from Activity, and not FragmentActivity.  FragmentActivity is a class that is introduced by the Android Support Packages for backwards compatibility and has not been added to the solution at this point.

In step #5, DetailsActivity should likewise inherit from Activity, not FragmentActivity for the exact same reasons.

Updated the walkthrough to reflect these changes.
Comment 4 Nischal 2012-07-16 12:00:18 UTC
After followed the updated document we are getting 5 build errors.

1. /Users/imac/Projects/FragmentSample/FragmentSample/TitlesFragment.cs(39,39):
Error CS0246: The type or namespace name `Fragment' could not be found. Are you
missing a using directive or an assembly reference? (CS0246) (FragmentSample)

2.
/Users/imac/Projects/FragmentSample/FragmentSample/DetailsFragment.cs(42,42):
Error CS0246: The type or namespace name `Fragment' could not be found. Are you
missing a using directive or an assembly reference? (CS0246) (FragmentSample)

3. /Users/imac/Projects/FragmentSample/FragmentSample/TitlesFragment.cs(38,38):
Error CS0115:
`FragmentSample.TitlesFragment.OnActivityCreated(Android.OS.Bundle)' is marked
as an override but no suitable method found to override (CS0115)
(FragmentSample)

4. /Users/imac/Projects/FragmentSample/FragmentSample/TitlesFragment.cs(38,38):
Error CS0115:
`FragmentSample.TitlesFragment.OnListItemClick(Android.Widget.ListView,
Android.Views.View, int, long)' is marked as an override but no suitable method
found to override (CS0115) (FragmentSample)

5.
/Users/imac/Projects/FragmentSample/FragmentSample/DetailsFragment.cs(38,38):
Error CS0115:
`FragmentSample.DetailsFragment.OnCreateView(Android.Views.LayoutInflater,
Android.Views.ViewGroup, Android.OS.Bundle)' is marked as an override but no
suitable method found to override (CS0115) (FragmentSample)

MD 3.0.3.3
MFA 4.2.4.167234518

Please suggest for the same
Comment 5 Tom Opgenorth 2012-07-16 13:05:17 UTC
Check the using statements in TitlesFragment.cs and DetailsFragment.cs. Ensure that you have
 using Android.App;

and not 
 using Android.Support.V4.App; 


The original source code was a snapshot of what the code would look like after the walkthrough was completed.  I have split the source code into two projects: one that corresponds to the first part (i.e. Android 3.1 or higher). The second project will work for Android 1.6 or higher and matches the 2nd part of the walkthrough.

I've uploaded a new version of the sample code at http://docs.xamarin.com/@api/deki/files/1617/=FragmentsWalkthrough3.zip.

Sorry for any confusion this might have cause.
Comment 6 Nischal 2012-07-19 03:59:54 UTC
It does not seem that Zip file is created as per document Part-1.

As we have observed that when we complete the part-1 as per document, we are seeing that all files are using namesapce FragmentSample while in the zip file all source code contain namesapce com.xamarin.sample.fragments.honeycomb and in our Project there are more 'using' specified than the Source code in Zip like:

using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.Util;
using Android.Widget;

In Zip file there are also 'Shakespeare.cs' file which is not mentioned in Part-1.

Now when we completed the Part1 as per document and we build the FragmentSample we are still getting same 5 build error as mentioned in above comment
Even after copying and paste the source code from Zip file to FragmentSample(Created by us) we are getting 6 build error

1. /Users/nischal/Projects/FragmentSample/FragmentSample/TitlesFragment.cs(35,35): Error CS0246: The type or namespace name `ListFragment' could not be found. Are you missing a using directive or an assembly reference? (CS0246) (FragmentSample)

2. /Users/nischal/Projects/FragmentSample/FragmentSample/DetailsFragment.cs(38,38): Error CS0246: The type or namespace name `Fragment' could not be found. Are you missing a using directive or an assembly reference? (CS0246) (FragmentSample)

3. /Users/nischal/Projects/FragmentSample/FragmentSample/TitlesFragment.cs(30,30): Error CS0115: `com.xamarin.sample.fragments.honeycomb.TitlesFragment.OnActivityCreated(Android.OS.Bundle)' is marked as an override but no suitable method found to override (CS0115) (FragmentSample)

4. /Users/nischal/Projects/FragmentSample/FragmentSample/TitlesFragment.cs(30,30): Error CS0115: `com.xamarin.sample.fragments.honeycomb.TitlesFragment.OnListItemClick(Android.Widget.ListView, Android.Views.View, int, long)' is marked as an override but no suitable method found to override (CS0115) (FragmentSample)

5. /Users/nischal/Projects/FragmentSample/FragmentSample/TitlesFragment.cs(30,30): Error CS0115: `com.xamarin.sample.fragments.honeycomb.TitlesFragment.OnSaveInstanceState(Android.OS.Bundle)' is marked as an override but no suitable method found to override (CS0115) (FragmentSample)

6. /Users/nischal/Projects/FragmentSample/FragmentSample/DetailsFragment.cs(30,30): Error CS0115: `com.xamarin.sample.fragments.honeycomb.DetailsFragment.OnCreateView(Android.Views.LayoutInflater, Android.Views.ViewGroup, Android.OS.Bundle)' is marked as an override but no suitable method found to override (CS0115) (FragmentSample)

If we run the Honeycomb project from Zip file it run successfully.
Comment 7 Tom Opgenorth 2012-07-19 12:50:53 UTC
Can you please confirm that the Android Support Packages have been installed as part of your Android SDK?

The build errors you are experiencing are consistent with the Support Packages not being installed.
Comment 8 PJ 2012-07-19 16:15:21 UTC
Do they need to be installed for Part 1 of the walkthrough?

If it is, it doesn't look to be an explicit pre-requisite. The first step of Part 2 is to add the Android Support Packages.


Also, I think Nischal is trying to outline the differences between an app created by following Part 1 of the walkthrough and the HoneyComb project in the solution linked in comment 5. Either way, the project should turn out identical, right?
Comment 9 Tom Opgenorth 2012-07-19 16:18:24 UTC
The code that is provided does have two projects in the one solution. The second project does require the Android Support Package.  Perhaps there needs to be one solution per project?

You are correct in that the final application will look the same in either case - the changes are internal only.