Namespace name RecyclerView could not be found - xamarin

I have been following along with Xamarin's guide, but am not able to reference RecyclerView to create an instance of it.
JDK 8 is installed. I have installed the Xamarin.Android.Support.v7.RecyclerView package and all of its dependencies. I'm targeting API level 24. But still no dice.
I can't find anything online that references this issue. Any ideas?
using System;
using System.Collections.Generic;
using System.Data;
using System.Threading.Tasks;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Support.V7.RecyclerView;
using Android.Views;
using Android.Widget;
namespace ArbanQC
{
[Activity(Label = "LoadsActivity")]
public class LoadsActivity : Activity
{
ProgressDialog progress;
bool ScheduleShowing;
RecyclerView grid; //Namespace is not recognized here.
List<Load> loads = new List<Load>();
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
RequestWindowFeature(WindowFeatures.NoTitle);
SetContentView(Resource.Layout.Loads);
grid = FindViewById<RecyclerView>(Resource.Id.loadsGrid); //Also not recognized here
ScheduleShowing = true;
}
}
}

Your using directive:
using Android.Support.V7.RecyclerView;
is incorrect - it should be:
using Android.Support.V7.Widget;

Related

Invoke method CsSCript Notepad++

I have this simple method CallMethod made in Notepad++ with CsScript.
How to invoke in from VS ?
namespace TestCall
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class ClassCall
{
public void CallMethod()
{
Console.Write("MethodCalling");
}
}
}
I made this invoker
namespace TestCall
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class Class1
{
public ClassCall a = new ClassCall();
public void Invoker()
{
Console.Write("MethodCall");
a.CallMethod();
Console.Write("MethodCalled");
}
}
}
But how to call it to be opened with Notepad++ with CSScript, so i can debug it?
Thanks
CS-Script offers a debugging option which can be used when you create an script.
Here's the github documentation.
Put the cursor on the line you want a breakpoint and press F9.

UWP Can't Get Method when i add services reference

I have to call SOAP Webservice. But it can't call at PCL. so I use dependencyservice in Android & UWP
Android can call SOAP Webservice. but when I call add services reference in xxx.UWP, It can't call Method( = Operation) at my WSDL site.
HOW CAN CALL WEB SERVICE (SOAP) IN UWP?? PLEASE HELP ME......
This is Dependency code
using System;
using System.ServiceModel;
using System.Threading.Tasks;
using Windows.UI.ViewManagement;
using Xamarin.Forms;
[assembly: Dependency(typeof(XXXXX.UWP.DependencyService.GetWI))]
namespace XXXXX.UWP.DependencyService
{
public class GetWI : Interface.IGetWI
{
public string[] getWIValues(string item)
{
GET_WI.WISWRProviderClient Client = new GET_WI.WISWRProviderClient();
return
}
}
}
enter image description here

Dataannotations error in xamarin

I've developed a xamarin.forms app. Everything was working fine and I updated my Visual Studio installation. But now i am getting below errors. Here is the code:
using SQLite;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using Xamarin.Forms;
namespace SampleApp
{
[SQLite.Table("CSV_File")]
public class FileCSV : INotifyPropertyChanged
{
private int _id;
[ForeignKey("Id")]
[PrimaryKey, AutoIncrement, NotNull]
public int Id
{
get
{
return _id;
}
set
{
this._id = value;
OnPropertyChanged(nameof(Id));
}
}
And fere are the errors:
Error CS0246 The type or namespace name 'ForeignKey' could not be
found (are you missing a using directive or an assembly
reference?)
Error CS0234 The type or namespace name 'DataAnnotations' does not
exist in the namespace 'System.ComponentModel' (are you missing an
assembly
reference?)
Change the target profile of your Shared Project to Profile259.

How to use the vibration service in a shared project Xamarin.Forms (Portable) in Visual Studio?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace App1
{
public partial class Page1 : ContentPage
{
public Page1()
{
InitializeComponent();
}
void OnButton_Clicked(object sender, EventArgs args)
{
/* code to vibrate */
}
}
}
I have not tested this myself but the simplest solution is to use the component developed already called CrossVibrate.
In general, you just have to create an abstraction (Interface) and implement it for each OS. This component handles this for you.

In which namespace is the extension method EntityTypeConfiguration.MapSingleType

I am trying to implement the following code to map a database to a POCO that has slightly different Property names then the corresponding columns, and a slightly different class name than the table name.
Here's the article
The problem is there is no method called MapSingleType. I have the following two methods available:
public EntityTypeConfiguration<TEntityType> Map<TDerived>(Action<EntityMappingConfiguration<TDerived>> derivedTypeMapConfigurationAction) where TDerived : class, TEntityType;
public EntityTypeConfiguration<TEntityType> Map(Action<EntityMappingConfiguration<TEntityType>> entityMappingConfigurationAction);
However, I can't find any examples of how to use them and I'm hoping to find the MapSingleType method since that works perfect for the very large number of columns I have to map.
I have downloaded CTP4 from here
And I am using EF 4.0.3
Here is the code I have so far:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using PlayingWithEF.DAL.CLS.Classes;
using System.Data.Entity.ModelConfiguration;
namespace PlayingWithEF.DAL.CLS.Context
{
public class CLSContext : DbContext
{
public DbSet<Listing> Listings { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Listing>().Map(...?)
}
}
}
You're going to have to map each property individually:
modelBuilder.Entity<Listing>()
.Property(l => l.YourProperty)
.HasColumnName("PropertyName");
modelBuilder.Entity<Listing>()
.ToTable("TableName");
You can't use CTP4 and EF 4.0.3 together, they're different versions of the same library.
I believe this functionality was removed from the betas at some point, and is no longer in the shipping version.

Resources