Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Start scanning
- scanner.ScanContinuously(opt, HandleScanResult);
- }
- private void HandleScanResult(ZXing.Result result)
- {
- string msg = "";
- if (result != null && !string.IsNullOrEmpty(result.Text))
- {
- msg = result.Text;
- var playerActivity = new Intent(myContext, typeof(AudioActivity));
- //-------------------------------------------------------------
- // Prerequisite: load all tracks onto "Assets/tracks" folder
- // You can put here qr code - track assignments here below
- // msg: decoded qr code
- // playerActivity.Putextra second parameter is a relative path
- // under "Assets" directory
- //--------------------------------------------------------------
- //Iterate through tracks stored in assets and load their titles into an array
- System.String[] trackArray = Application.Context.Assets.List("tracks");
- bool trackFound = false;
- foreach (string track in trackArray)
- {
- if (track.Equals(msg + ".mp3"))
- {
- playerActivity.PutExtra("Track", "tracks/" + msg + ".mp3");
- for (int i = 0; i < PostList.postList.Count; i++)
- {
- if (PostList.postList.ElementAt(i).code.Equals(msg))
- playerActivity.PutExtra("TrackTitle", PostList.postList.ElementAt(i).title);
- }
- myContext.StartActivity(playerActivity);
- trackFound = true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement