public static Task StartLocationService()
        {
            if (_isRunning)
                return Task.FromResult(true);
            _isRunning = true;
            // Starting a service like this is blocking, so we want to do it on a background thread
            return Task.Run(() =>
            {
                // Start our main service
                Log.Debug("App", "Calling StartService");
                Android.App.Application.Context.StartService(new Intent(Android.App.Application.Context,
                    typeof (GeolocationService)));

                // bind our service (Android goes and finds the running service by type, and puts a reference
                // on the binder to that service)
                // The Intent tells the OS where to find our Service (the Context) and the Type of Service
                // we're looking for (LocationService)
                var locationServiceIntent = new Intent(Android.App.Application.Context, typeof (GeolocationService));
                Log.Debug("App", "Calling service binding");

                // Finally, we can bind to the Service using our Intent and the ServiceConnection we
                // created in a previous step.
                Android.App.Application.Context.BindService(locationServiceIntent, LocationServiceConnection,
                    Bind.AutoCreate);
            });
        }
        private void ImageChooserCallback(int requestCode, Result resultCode, Intent intent)
        {
            if (resultCode == Result.Ok)
            {
                if (ImageSelected != null)
                {
                    Android.Net.Uri uri = intent.Data;
                    if (ImageSelected != null)
                    {
                        ImageSource imageSource = ImageSource.FromStream(() => Forms.Context.ContentResolver.OpenInputStream(uri));
                        ImageSelected.Invoke(this, new ImageSourceEventArgs(imageSource));

                        string doc_id = "";
                        using (var c1 = Forms.Context.ContentResolver.Query (uri, null, null, null, null)) {
                            c1.MoveToFirst ();
                            string document_id = c1.GetString (0);
                            doc_id = document_id.Substring (document_id.LastIndexOf (":") + 1);
                        }

                        string selection = Android.Provider.MediaStore.Images.Media.InterfaceConsts.Id + " =? ";
                        var cursor = Forms.Context.ContentResolver.Query (MediaStore.Images.Media.ExternalContentUri, null, selection, new string[] {doc_id}, null);
                        var colIndex = cursor.GetColumnIndex(Android.Provider.MediaStore.Images.Media.InterfaceConsts.Data);
                        cursor.MoveToFirst();
                        App.imagePath = cursor.GetString (colIndex);
                        cursor.Close ();

                    }
                }
            }
        }
 public void RecordNotificationReceived(Intent message)
 {
     var id = message.GetStringExtra(PlatformAccess.BuddyPushKey);
     if (!String.IsNullOrEmpty(id)) {
         PlatformAccess.Current.OnNotificationReceived(id);
     }
 }
Example #4
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

                // Set our view from the "main" layout resource
                SetContentView(Resource.Layout.Main);

                // Get our button from the layout resource,
                // and attach an event to it
                Button button = FindViewById<Button>(Resource.Id.MyButton);

                button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };

                Button button1 = FindViewById<Button>(Resource.Id.button1);
                TextView textview = FindViewById<TextView>(Resource.Id.textView1);
                button1.Click += delegate { textview.Text = string.Format("{0} hello zzb!!", count); };

                Button btnPhone = FindViewById<Button>(Resource.Id.btnPhone);

                btnPhone.Click += delegate { };
                btnPhone.Click += BtnPhone_Click;

                Button btnToSec = FindViewById<Button>(Resource.Id.btnToSec);
                btnToSec.Click += delegate {
                    Intent intent = new Intent(this, typeof(SecondActivity));
                    StartActivity(intent);
                };
        }
		public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			// Use this to return your custom view for this Fragment
			var view = inflater.Inflate(Resource.Layout.HeaderFragmentLayout, container, false);
			var homeBtn = view.FindViewById<ImageView>(Resource.Id.HeaderLogo);
			var overlayBtn = view.FindViewById<ImageView>(Resource.Id.HeaderOverlay);
			var animIn = AnimationUtils.LoadAnimation(Activity.BaseContext, Resource.Animation.Overlay_animIn);

			homeBtn.Click += delegate
			{
				if (!(Activity is MainActivity))
				{
					var i = new Intent(Activity, typeof(MainActivity));
					i.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTop);
					Activity.StartActivity(i);
				}
			};

			overlayBtn.Click += delegate
			{
				overlay.View.StartAnimation(animIn);
				overlay.Initialize();
				overlay.View.Visibility = ViewStates.Visible;
			};

			return view;
		}
Example #6
0
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			//League league = new League ();
			Spinner chooseTeamSpinner = FindViewById<Spinner> (Resource.Id.chooseTeamSpinner);
			chooseTeamSpinner.ItemSelected += new EventHandler<AdapterView.ItemSelectedEventArgs> (chooseTeamSpinner_ItemSelected);
			var adapter = ArrayAdapter.CreateFromResource (
				this, Resource.Array.teams_array, Android.Resource.Layout.SimpleSpinnerItem);

			adapter.SetDropDownViewResource (Android.Resource.Layout.SimpleSpinnerDropDownItem);
			chooseTeamSpinner.Adapter = adapter;

			// Get our button from the layout resource,
			// and attach an event to it
			Button beginSeasonButton = FindViewById<Button> (Resource.Id.beginSeasonButton);
			beginSeasonButton.Click += (sender, e) =>
			{
				var intent = new Intent(this, typeof(SeasonActivity));
				intent.PutExtra("userTeam", userTeam);
				StartActivity(intent);
			};
		}
        /// <inheritdoc/>
        public override void OnActivityResult(int requestCode, int resultCode, Intent data)
        {
            ZTnTrace.Trace(MethodBase.GetCurrentMethod());

            switch (requestCode)
            {
                case AddNewAccount:
                    switch (resultCode)
                    {
                        case -1:
                            var battleTag = data.GetStringExtra("battleTag");
                            var host = data.GetStringExtra("host");

                            D3Context.Instance.DbAccounts.Insert(battleTag, host);

                            IListAdapter careerAdapter = new SimpleCursorAdapter(Activity, Android.Resource.Layout.SimpleListItem2, cursor, accountsFromColumns, accountsToId);
                            Activity.FindViewById<ListView>(Resource.Id.AccountsListView)
                                .Adapter = careerAdapter;

                            Toast.MakeText(Activity, "Account added", ToastLength.Short)
                                .Show();
                            break;
                    }
                    break;
            }

            base.OnActivityResult(requestCode, resultCode, data);
        }
Example #8
0
 private void ButtonOnClick(object sender, EventArgs eventArgs)
 {
     Intent = new Intent();
     Intent.SetType("image/*");
     Intent.SetAction(Intent.ActionGetContent);
     StartActivityForResult(Intent.CreateChooser(Intent, "Select Picture"), PickImageId);
 }
        private void ShowDetails(int playId)
        {
            _currentPlayId = playId;
            if (_isDualPane)
            {
                // We can display everything in-place with fragments.
                // Have the list highlight this item and show the data.
                ListView.SetItemChecked(playId, true);

                // Check what fragment is shown, replace if needed.
                var details = FragmentManager.FindFragmentById(Resource.Id.details) as DetailsFragment;
                if (details == null || details.ShownPlayId != playId)
                {
                    // Make new fragment to show this selection.
                    details = DetailsFragment.NewInstance(playId);

                    // Execute a transaction, replacing any existing
                    // fragment with this one inside the frame.
                    var ft = FragmentManager.BeginTransaction();
                    ft.Replace(Resource.Id.details, details);
                    ft.SetTransition(FragmentTransit.FragmentFade);
                    ft.Commit();
                }
            }
            else
            {
                // Otherwise we need to launch a new activity to display
                // the dialog fragment with selected text.
                var intent = new Intent();

                intent.SetClass(Activity, typeof(DetailsActivity));
                intent.PutExtra("current_play_id", playId);
                StartActivity(intent);
            }
        }
        void Buy_Click(object sender, EventArgs e)
        {
            var intent = new Intent (this, typeof(FinalDialog));

            intent.PutExtra ("Extra_Link", _VideoLink);
            StartActivity(intent);
        }
Example #11
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            comicListView = FindViewById<ListView>(Resource.Id.ComicList);
            comicListView.ChoiceMode = ChoiceMode.Multiple;
            comicListView.FastScrollEnabled = true;

            data = new ComicList (new CSVParser (Assets.Open ("Data/titles.csv")));

            // wire up task click handler
            if(comicListView != null) {
                comicListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
                {
                    // Starting to think I should just serialize this
                    var comicDetails = new Intent (this, typeof (ComicDetailsActivity));
                    comicDetails.PutExtra("ComicName", data[e.Position].Name);
                    comicDetails.PutExtra("ComicDescription", data[e.Position].Description);
                    comicDetails.PutExtra("ComicPublisher", data[e.Position].Publisher);
                    comicDetails.PutExtra("ComicDate", data[e.Position].Date);
                    comicDetails.PutExtra("ID", data[e.Position].ID);
                    comicDetails.PutExtra("Favourite", data.IsFavourite(e.Position));
                    comicDetails.PutExtra("OtherComics", data.GetPublisherCount(data[e.Position].Publisher) - 1);
                    StartActivity (comicDetails);
                };
            }
        }
        internal void InitMediaSession(string packageName, MediaServiceBinder binder)
        {
            try
            {
                if (mediaSessionCompat == null)
                {
                    Intent nIntent = new Intent(applicationContext, typeof(MediaPlayer));
                    PendingIntent pIntent = PendingIntent.GetActivity(applicationContext, 0, nIntent, 0);

                    RemoteComponentName = new ComponentName(packageName, new RemoteControlBroadcastReceiver().ComponentName);
                    mediaSessionCompat = new MediaSessionCompat(applicationContext, "XamarinStreamingAudio", RemoteComponentName, pIntent);
                    mediaControllerCompat = new MediaControllerCompat(applicationContext, mediaSessionCompat.SessionToken);
                    NotificationManager = new MediaNotificationManagerImplementation(applicationContext, CurrentSession.SessionToken, _serviceType);
                }
                mediaSessionCompat.Active = true;
                mediaSessionCompat.SetCallback(binder.GetMediaPlayerService<MediaServiceBase>().AlternateRemoteCallback ?? new MediaSessionCallback(this));
                mediaSessionCompat.SetFlags(MediaSessionCompat.FlagHandlesMediaButtons | MediaSessionCompat.FlagHandlesTransportControls);
                _packageName = packageName;
                _binder = binder;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
 public AddEventToCalAction(Context context, Intent intent, int drawable, string url)
 {
     Drawable = drawable;
     Context = context;
     Intent = intent;
     Url = url;
 }
		public void DidEnterRegion(AltBeaconOrg.BoundBeacon.Region region)
		{
			// In this example, this class sends a notification to the user whenever a Beacon
			// matching a Region (defined above) are first seen.
			Log.Debug(TAG, "did enter region.");
			if (!haveDetectedBeaconsSinceBoot) 
			{
				Log.Debug(TAG, "auto launching MonitoringActivity");

				// The very first time since boot that we detect an beacon, we launch the
				// MainActivity
				var intent = new Intent(this, typeof(MainActivity));
				intent.SetFlags(ActivityFlags.NewTask);
				// Important:  make sure to add android:launchMode="singleInstance" in the manifest
				// to keep multiple copies of this activity from getting created if the user has
				// already manually launched the app.
				this.StartActivity(intent);
				haveDetectedBeaconsSinceBoot = true;
			} 
			else 
			{
				if (mainActivity != null) {
					Log.Debug(TAG, "I see a beacon again");
				} 
				else 
				{
					// If we have already seen beacons before, but the monitoring activity is not in
					// the foreground, we send a notification to the user on subsequent detections.
					Log.Debug(TAG, "Sending notification.");
					SendNotification();
				}
			}
		}
Example #15
0
		public override void OnReceive(Context context, Intent intent)
		{
			Android.Util.Log.Info("MonoGame", intent.Action.ToString());
			if(intent.Action == Intent.ActionScreenOff)
			{
				ScreenReceiver.ScreenLocked = true;
				MediaPlayer.IsMuted = true;
			}
			else if(intent.Action == Intent.ActionScreenOn)
			{
                // If the user turns the screen on just after it has automatically turned off, 
                // the keyguard will not have had time to activate and the ActionUserPreset intent
                // will not be broadcast. We need to check if the lock is currently active
                // and if not re-enable the game related functions.
                // http://stackoverflow.com/questions/4260794/how-to-tell-if-device-is-sleeping
                KeyguardManager keyguard = (KeyguardManager)context.GetSystemService(Context.KeyguardService);
                if (!keyguard.InKeyguardRestrictedInputMode())
                {
                    ScreenReceiver.ScreenLocked = false;
                    MediaPlayer.IsMuted = false;
                }
			}
			else if(intent.Action == Intent.ActionUserPresent)
			{
                // This intent is broadcast when the user unlocks the phone
				ScreenReceiver.ScreenLocked = false;
				MediaPlayer.IsMuted = false;
			}
		}
        public void PushPresenter(object presenter)
        {
            object oldPresenter = application.Presenter;
            if(presenter != oldPresenter)
            {
                application.Presenter = presenter;
                Intent i = null;

                if(presenter is SearchResultsPresenter)
                {
                    i = new Intent(application.CurrentActivity, typeof(SearchResultsView));
                }
                else if(presenter is PropertyPresenter)
                {
                    i = new Intent(application.CurrentActivity, typeof(PropertyView));
                }
                else if(presenter is FavouritesPresenter)
                {
                    i = new Intent(application.CurrentActivity, typeof(FavouritesView));
                }

                if(i != null)
                    application.CurrentActivity.StartActivity(i);
            }
        }
Example #17
0
 protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
 {
     if (requestCode == 111 && resultCode == Result.Ok) {
         Console.WriteLine (data.Data);
     }
     base.OnActivityResult (requestCode, resultCode, data);
 }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Create your application here
            SetContentView (Resource.Layout.Login);

            EditText txtIPAddress = (EditText)FindViewById (Resource.Id.txtIPAddress);
            txtIPAddress.Text = this.GetPreference ("preference_q16_address");
            Button btnOk = (Button)FindViewById (Resource.Id.btnOk);
            btnOk.Click += (sender, e) =>
            {
                this.SetPreference("preference_q16_address", txtIPAddress.Text);
                var main = new Intent(this, typeof(MainActivity));
                main.PutExtra("address", txtIPAddress.Text);
                main.PutExtra("demo", false);
                StartActivity(main);
            };
            Button btnDemo = (Button)FindViewById (Resource.Id.btnDemo);
            btnDemo.Click += (sender, e) =>
            {
                var main = new Intent(this, typeof(MainActivity));
                main.PutExtra("address", "demo");
                main.PutExtra("demo", true);
                StartActivity(main);
            };
        }
		protected override void OnHandleIntent (Intent intent)
		{
			google_api_client.BlockingConnect (TIME_OUT_MS, TimeUnit.Milliseconds);
			Android.Net.Uri dataItemUri = intent.Data;
			if (!google_api_client.IsConnected) {
				Log.Error (TAG, "Failed to update data item " + dataItemUri +
				" because client is disconnected from Google Play Services");
				return;
			}
			var dataItemResult = WearableClass.DataApi.GetDataItem (
				google_api_client, dataItemUri).Await ().JavaCast<IDataApiDataItemResult> ();

			var putDataMapRequest = PutDataMapRequest.CreateFromDataMapItem (
				DataMapItem.FromDataItem (dataItemResult.DataItem));
			var dataMap = putDataMapRequest.DataMap;

			//update quiz status variables
			int questionIndex = intent.GetIntExtra (EXTRA_QUESTION_INDEX, -1);
			bool chosenAnswerCorrect = intent.GetBooleanExtra (EXTRA_QUESTION_CORRECT, false);
			dataMap.PutInt (Constants.QUESTION_INDEX, questionIndex);
			dataMap.PutBoolean (Constants.CHOSEN_ANSWER_CORRECT, chosenAnswerCorrect);
			dataMap.PutBoolean (Constants.QUESTION_WAS_ANSWERED, true);
			PutDataRequest request = putDataMapRequest.AsPutDataRequest ();
			WearableClass.DataApi.PutDataItem (google_api_client, request).Await ();

			//remove this question notification
			((NotificationManager)GetSystemService (NotificationService)).Cancel (questionIndex);
			google_api_client.Disconnect ();
		}
    public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
    {
      var root = inflater.Inflate(Resource.Layout.fragment_contacts, container, false);

      refresher = root.FindViewById<SwipeRefreshLayout>(Resource.Id.refresher);
      refresher.SetColorScheme(Resource.Color.blue);

      refresher.Refresh += async delegate
      {
        if (viewModel.IsBusy)
          return;

        await viewModel.GetContactsAsync();
        Activity.RunOnUiThread(() => { ((BaseAdapter)listView.Adapter).NotifyDataSetChanged(); });

      };

      viewModel.PropertyChanged += PropertyChanged;

      listView = root.FindViewById<ListView>(Resource.Id.list);

      listView.Adapter = new ContactAdapter(Activity, viewModel);

      listView.ItemLongClick += ListViewItemLongClick;
      listView.ItemClick += ListViewItemClick;
      var fab = root.FindViewById<FloatingActionButton>(Resource.Id.fab);
      fab.AttachToListView(listView);
      fab.Click += (sender, args) =>
      {
        ContactDetailsActivity.ViewModel = null;
        var intent = new Intent(Activity, typeof(ContactDetailsActivity));
        StartActivity(intent);
      };
      return root;
    }
        /// <summary>
        /// Helper method to extract the full Push JSON provided to LeanCloud, including any
        /// non-visual custom information.
        /// </summary>
        /// <param name="intent"><see cref="Android.Content.Intent"/> received typically
        /// from a <see cref="Android.Content.BroadcastReceiver"/></param>
        /// <returns>Returns the push payload in the intent. Returns an empty dictionary if the intent
        /// doesn't contain push payload.</returns>
        internal static IDictionary<string, object> PushJson(Intent intent)
        {
            IDictionary<string, object> result = new Dictionary<string, object>();
              string messageType = intent.GetStringExtra("message_type");

              if (messageType != null) {
             // The GCM docs reserve the right to use the message_type field for new actions, but haven't
             // documented what those new actions are yet. For forwards compatibility, ignore anything
             // with a message_type field.
              } else {
            string pushDataString = intent.GetStringExtra("data");
            IDictionary<string, object> pushData = null;

            // We encode the data payload as JSON string. Deserialize that string now.
            if (pushDataString != null) {
              pushData = Json.Parse(pushDataString) as IDictionary<string, object>;
            }

            if (pushData != null) {
              result = pushData;
            }
              }

              return result;
        }
Example #22
0
		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			// Get our button from the layout resource,
			// and attach an event to it
			Button button = FindViewById<Button> (Resource.Id.btnFoto);
			
			button.Click += delegate {
				Intent camera = new Intent (MediaStore.ActionImageCapture);

				IList<Android.Content.PM.ResolveInfo> availableActivities = this.PackageManager.QueryIntentActivities (camera, Android.Content.PM.PackageInfoFlags.MatchDefaultOnly);
				
				if (availableActivities != null && availableActivities.Count > 0) {              
					var dir = new Java.IO.File (
						Android.OS.Environment.GetExternalStoragePublicDirectory (
						Android.OS.Environment.DirectoryPictures), "CameraAppDemo");     
					
					if (!dir.Exists ()) {
						dir.Mkdirs ();  
					}   

					_file = new Java.IO.File (dir, String.Format ("myPhoto{0}.jpg", Guid.NewGuid ()));     

					camera.PutExtra (MediaStore.ExtraOutput,
					                 Android.Net.Uri.FromFile (_file));                    
					StartActivityForResult (camera, 0);
				}

			};
		}
 public void Dispatch(nView view)
 {
     Activity context = (Activity) view.Action.Params[nAndroidView.CONTEXT];
     Type target = (Type) view.Action.Params[nAndroidView.TARGET];
     var intent = new Intent(context, target);
     context.StartActivity(intent);
 }
 private void OnItemClick(object sender, AdapterView.ItemClickEventArgs e)
 {
     var person = _people[e.Position];
     var intent = new Intent(this, typeof(PersonDetailActivity));
     intent.PutExtra("PersonId", person.Id);
     StartActivity(intent);
 }
 private Intent GetShareIntent()
 {
     var intent = new Intent(Intent.ActionSend);
       intent.SetType("text/plain");
     intent.PutExtra(Intent.ExtraText, feedItem.Title + " " + feedItem.Link + " #PlanetXamarin");
       return intent;
 }
Example #26
0
        public void CriarChamada(Activity activity)
        {
            isRecording = !isRecording;
            if (isRecording)
            {
                // Cria o INTENT
                var voiceIntent = new Intent(RecognizerIntent.ActionRecognizeSpeech);
                voiceIntent.PutExtra(RecognizerIntent.ExtraLanguageModel, RecognizerIntent.LanguageModelFreeForm);

                // Abre um modal com uma mensagem de voz
                voiceIntent.PutExtra(RecognizerIntent.ExtraPrompt, "Diga o nome da pessoa");

                // Se passar de 5.5s considera que não há mensagem falada
                voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputCompleteSilenceLengthMillis, 5500);
                voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputPossiblyCompleteSilenceLengthMillis, 1500);
                voiceIntent.PutExtra(RecognizerIntent.ExtraSpeechInputMinimumLengthMillis, 15000);
                voiceIntent.PutExtra(RecognizerIntent.ExtraMaxResults, 1);

                // Para chamadas em outras líguas
                // voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.German);
                // if you wish it to recognise the default Locale language and German
                // if you do use another locale, regional dialects may not be recognised very well

                voiceIntent.PutExtra(RecognizerIntent.ExtraLanguage, Java.Util.Locale.Default);
                activity.StartActivityForResult(voiceIntent, Constants.VOICE);
            }
        }
Example #27
0
        protected override void OnListItemClick(ListView l, View v, int position, long id)
        {
            var url = _adapter.GetMapUrl (position);
            var intent = new Intent (Intent.ActionView, Uri.Parse(url));

            StartActivity (intent);
        }
        public void SetHeader(String title, bool btnHomeVisible, bool btnFeedbackVisible)
        {
            ViewStub stub = (ViewStub) FindViewById(Resource .Id .vsHeader);
              		View inflated = stub.Inflate();

            TextView txtTitle = (TextView) inflated.FindViewById(Resource.Id.txtHeading );
            txtTitle.Text=title;

            Button btnHome = (Button) inflated.FindViewById(Resource .Id.btnHome );

            if(!btnHomeVisible)
                btnHome.Visibility = Android.Views .ViewStates .Invisible ;

            btnHome .Click+= delegate(object sender, EventArgs e) {

                 Intent intent = new Intent(this.ApplicationContext , typeof (HomeActivity ));
              		 intent.SetFlags (ActivityFlags.ClearTop );
              		 StartActivity(intent);
            };

            Button btnFeedback = (Button) inflated.FindViewById( Resource.Id.btnFeedback);
            if(!btnFeedbackVisible)
                btnFeedback.Visibility = Android.Views .ViewStates .Invisible ;

            btnFeedback .Click += delegate(object sender, EventArgs e) {
                 Intent intent = new Intent(this.ApplicationContext , typeof (ActivityFeedback));
              		 intent.SetFlags (ActivityFlags.ClearTop );
              		 StartActivity(intent);

            };
        }
Example #29
0
 void GridOnItemClick(object sender, AdapterView.ItemClickEventArgs itemClickEventArgs)
 {
     var intent = new Intent(Activity, typeof(FriendActivity));
     intent.PutExtra("Title", friends[itemClickEventArgs.Position].Title);
     intent.PutExtra("Image", friends[itemClickEventArgs.Position].Image);
     StartActivity(intent);
 }
Example #30
0
        //http://forums.xamarin.com/discussion/19362/xamarin-forms-splashscreen-in-android
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            string databasePath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal);
            string databaseFull = System.IO.Path.Combine (databasePath, Global.databaseName);

            if (File.Exists (databaseFull) == true) {
                //it's not the first time
                var plat = new SQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid ();
                var cn = new SQLite.Net.SQLiteConnection (plat, databaseFull);
                var m = cn.Table<MacroCategories> ().ToList ();
                Global.k_MacroCategories = new MyObservableCollection<MacroCategories> (m);
                var c = cn.Table<Categories> ().ToList ();
                Global.K_Categories = new MyObservableCollection<Categories> (c);
                var p = cn.Table<POIs> ().ToList ();
                Global.K_POIs = new MyObservableCollection<POIs> (p);
                var cp = cn.Table<Categories_POIs> ().ToList ();
                Global.K_Categories_POIs = new MyObservableCollection<Categories_POIs> (cp);
                var pg = cn.Table<POIsPictures> ().ToList ();
                Global.K_POIsPictures = new MyObservableCollection<POIsPictures> (pg);
                Global.K_CCFs = Global.createCCFs ();
                Thread.Sleep (1); // Simulate a long loading process on app startup
            } else {
                Thread.Sleep (2000); // Simulate a long loading process on app startup
            }

            var intent = new Intent (this, typeof(MainActivity));
            StartActivity (intent);

            Finish ();
            // Create your application here
        }