onclick listener inside of a Service

I am working on Floating and moveable action button app which will run as a service on screen.
I followed this link :- http://alejandroruizvarela.blogspot.in/2013/11/servicio-de-notificaciones-tipo.html.
I am running a service on device screen in a round circle like an facebook chat.
But I want to call an activity / layout etc to take inputs....inside service. I want to call activity on click of floating action.
I have no idea,weather is this possible or not?
How to call onclicklistener inside service to open a pop up layout or activity from service ,when i clicked the button .
Any other option is also welcome..


  • Vikas85Vikas85 USMember ✭✭
    edited December 2015

    I tried following code :

    Head.SetOnClickListener(new View.IOnClickListener() {        
                        //public void onClick(View v) {
                        //       Toast.makeText(getBaseContext(), "Image Clicked",Toast.LENGTH_SHORT).show();          
                        //    }
                        public void onClick(View v) {
                               //Toast reponse = Toast.MakeText(Activity, string.Format("Image Clicked"), ToastLength.Long);       
                            //Toast reponse = Toast.MakeText(Activity, string.Format("Image Clicked"), ToastLength.Short);

    Also tried

    chatHead = new ImageView(this);           
    chatHead.Click += (object sender, EventArgs e) =>
                    var path = global::Android.OS.Environment.ExternalStorageDirectory.AbsolutePath;
                    var filename = System.IO.Path.Combine(path.ToString(), "Chathead.txt");
                    using (var streamWriter = new StreamWriter(filename, true))
                        streamWriter.WriteLine("Image Clicked");
                    //Toast reponse = Toast.MakeText(this, "Image Clicked", ToastLength.Short);
                    //var intent = new Intent(Activity, typeof(NewsDetailActivity));
                    //intent.PutExtra("newsId", _newsId);

    But None worked inside service. Kindly suggest .

  • adamkempadamkemp USInsider, Developer Group Leader mod

    I believe Facebook had to create their own custom app launcher in order to show persistent UI like that. I could be wrong. Regardless, this is not a Forms question. It's an Android question so I'm moving the question to the Android forum.

Sign In or Register to comment.