Advertisement
Guest User

Untitled

a guest
Oct 21st, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. //Start scanning
  2. scanner.ScanContinuously(opt, HandleScanResult);
  3.  
  4. }
  5.  
  6. private void HandleScanResult(ZXing.Result result)
  7. {
  8. string msg = "";
  9.  
  10. if (result != null && !string.IsNullOrEmpty(result.Text))
  11. {
  12.  
  13. msg = result.Text;
  14.  
  15. var playerActivity = new Intent(myContext, typeof(AudioActivity));
  16.  
  17. //-------------------------------------------------------------
  18. // Prerequisite: load all tracks onto "Assets/tracks" folder
  19. // You can put here qr code - track assignments here below
  20. // msg: decoded qr code
  21. // playerActivity.Putextra second parameter is a relative path
  22. // under "Assets" directory
  23. //--------------------------------------------------------------
  24.  
  25. //Iterate through tracks stored in assets and load their titles into an array
  26. System.String[] trackArray = Application.Context.Assets.List("tracks");
  27.  
  28. bool trackFound = false;
  29. foreach (string track in trackArray)
  30. {
  31. if (track.Equals(msg + ".mp3"))
  32. {
  33. playerActivity.PutExtra("Track", "tracks/" + msg + ".mp3");
  34.  
  35. for (int i = 0; i < PostList.postList.Count; i++)
  36. {
  37. if (PostList.postList.ElementAt(i).code.Equals(msg))
  38. playerActivity.PutExtra("TrackTitle", PostList.postList.ElementAt(i).title);
  39. }
  40. myContext.StartActivity(playerActivity);
  41.  
  42. trackFound = true;
  43.  
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement