More Related Content
More from university of Gujrat, pakistan (20)
Services
- 3. @Override
public void onDestroy() {
super.onDestroy();
Toast.makeText(this,"Service is destroy",Toast.LENGTH_LONG).show();
}
}
main.java
package com.example.spinneenew;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.Manifest;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void startservic(View v)
{
Intent intent=new Intent(this,Myservice.class);
startservic(intent);
}
public void stopservic(View v) {
stopservic(new Intent(this, Myservice.class));
}
}