Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- startService.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- Log.d("myE", "Start click");
- try
- {
- Context ctx = (Context)MonitoringFragment.this.getActivity();
- ctx.startService(new Intent(getContext(), CheckService.class));
- }
- catch (Exception e)
- Log.d("myE", e.toString());
- Log.d("myE", "End click");
- }
- }
- public int onStartCommand(Intent intent, int flags, int startId) {
- try {
- Log.d("myE", "onStartCommand");
- }
- catch (Exception e) {
- Log.d("myE", e.toString());
- }
- return START_STICKY;
- }
- }
- <service android:name=".MonitoringFragment$CheckService" />
Add Comment
Please, Sign In to add comment