Open GoogleCodeExporter opened 9 years ago
Hello,
Thanks for the report! However, I have no experience with Xamarin and am not
sure what is it that you are trying to accomplish here.
Could you share some code snippets so that we can get a better idea of what is
not working?
Thanks!
Alain
Original comment by ala...@google.com
on 18 Feb 2014 at 5:58
So in Xamarin, all the code is in C# rather than Java. Here is the entire
activity for the app so far:
using System;
using System.Collections.Generic;
using Android.App;
using Android.Content;
using Android.Glass.App;
using Android.OS;
using Android.Runtime;
using Android.Speech;
using Android.Views;
using Android.Widget;
using Scandit;
namespace GlassDemoApp
{
[Activity(Label = "Scan Product", MainLauncher = true, Icon = "@drawable/icon")]
[IntentFilter(new[] { "com.google.android.glass.action.VOICE_TRIGGER" })]
[MetaData("com.google.android.glass.VoiceTrigger", Resource = "@xml/voicetrigger")]
public class ScanActivity : Activity, Scandit.Interfaces.IScanditSDKListener
{
private ScanditSDKBarcodePicker scanner;
public static string appKey = "Some App Key";
public string product = "No Product Found";
public int image = @Resource.Drawable.icon;
public string price = "Free";
public string speechResults = null;
public string quantity = "Quantity: 5";
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Setup the barcode scanner
scanner = new ScanditSDKBarcodePicker(this, appKey);
scanner.OverlayView.AddListener(this);
// Start scanning
scanner.StartScanning();
// Show scan user interface
SetContentView(scanner);
}
public void DidScanBarcode(string barcode, string symbology) {
//Set results to card
//string results = String.Format("{0}, '{1}'", symbology, barcode);
string results = String.Format("{0}", barcode);
if (results == "072250010788") {
product = "Mrs. Freshley's Pecan Twirls - Pack of 8";
image = @Resource.Drawable.pecan;
price = "$5.99";
} else if (results == "086719803002") {
product = "La Primera Tortilla Chips";
image = @Resource.Drawable.chips;
price = "$4.99";
} else if (results == "076296000192") {
product = "Crescent Creamery 2% Milk - Half Gallon";
image = @Resource.Drawable.milk;
price = "$2.99";
};
Card card = createCard(price, quantity);
SetContentView(card.ToView());
}
public Card createCard(string price) {
Card card = new Card(this);
card.SetText(product);
card.AddImage(image);
card.SetFootnote(price);
return card;
}
public Card createCard(string price, string quantity) {
Card card = new Card(this);
card.SetText(product);
card.AddImage(image);
card.SetFootnote(price + " " + quantity);
return card;
}
public void DidCancel() {
var card = new Card(this);
//Set results to card
string results = String.Format("Cancel was pressed.");
card.SetFootnote(results);
//Show card
SetContentView(card.ToView());
}
public void DidManualSearch(string text) {
var card = new Card(this);
//Set results to card
string results = String.Format("Search was used.");
card.SetText(results);
//Show card
SetContentView(card.ToView());
}
}
}
What this does now is scan a barcode and display product information and an
image. This is a demo, so all the prices and products are hardcoded. What I
expected to happen was that I create a card with just the price in the
footnote, call the speech recognizer after a delay, collect the results, and
then show the same card but with the price AND the quantity in the footnote.
Original comment by g...@pinskiy.us
on 18 Feb 2014 at 7:45
Hello,
I don't think there is any issue with the GDK as `setContentView` should
properly update the Activity's content view.
Unfortunately, I am not sure who else in this issue tracker would be able to
help you with any Xamarin specific issues. My suggestion would be to post your
questions on StackOverflow and use Xamarin related tags.
Best,
Alain
Original comment by ala...@google.com
on 18 Feb 2014 at 10:00
Original issue reported on code.google.com by
g...@pinskiy.us
on 14 Feb 2014 at 6:14