0

I really had many codes in my class and it calls Main. But I want that class running in the background.

My way: I created another class and extend Service. Then, I use onStartCommand calling my class which called Main and has many codes!

error: ....Service cannot be a cast to a android.app.Activity

I have really no idea!! Somebody help!

Skying
  • 21
  • 1
  • 4
  • Any simple or advice are really help me! – Skying Jan 04 '15 at 12:36
  • [check this may be help this if not then paste ur code here ][1] [1]: http://stackoverflow.com/questions/4765517/start-service-in-android – wadali Jan 04 '15 at 12:36
  • Thanks!But I want Service to call another class.Not class calling service. – Skying Jan 04 '15 at 12:40
  • ok then user then Read about messange class in android by which u can send message to another class and u can do any thing u can call class form messager handler :) – wadali Jan 04 '15 at 12:43
  • http://stackoverflow.com/questions/4300291/example-communication-between-activity-and-service-using-messaging this can help u :) – wadali Jan 04 '15 at 12:47
  • This program can get byte from a device, but I need it getting byte in the background. At that time, the user can do anything else on his cellphone. – Skying Jan 04 '15 at 12:49
  • Bluetooth program needs to extends ActionBarActivity, but the program which running in the background needs to extend Service.When I Extend two classes, the codes from Bluetooth program which extend ActionBarActivity needs to be inside a public class! Help!! – Skying Jan 04 '15 at 12:59
  • why u need to create new object of Actionbaractivity create both class seprate and action baractivity implements from service call backs and by whcih why u can get call from service and u can do see answer 5 http://stackoverflow.com/questions/23586031/calling-activity-class-method-from-service-class – wadali Jan 04 '15 at 13:21

0 Answers0