package com.demo;
public class MyserviceDemoact extends Activity {
/** Called when the activity is first created. */
Button Bstart,Bstop;
Intent i;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Bstart =(Button) findViewById(R.id.button1);
Bstop =(Button) findViewById(R.id.button2);
i=new Intent(MyserviceDemoact.this,MySer.class);
Bstart.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
// TODO Auto-generated method stub
startService(i);
}
});
Bstop.setOnClickListener(new OnClickListener()
{
public void onClick(View v) {
// TODO Auto-generated method stub
stopService(i);
}
});
}
}
public class MyserviceDemoact extends Activity {
/** Called when the activity is first created. */
Button Bstart,Bstop;
Intent i;
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Bstart =(Button) findViewById(R.id.button1);
Bstop =(Button) findViewById(R.id.button2);
i=new Intent(MyserviceDemoact.this,MySer.class);
Bstart.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
// TODO Auto-generated method stub
startService(i);
}
});
Bstop.setOnClickListener(new OnClickListener()
{
public void onClick(View v) {
// TODO Auto-generated method stub
stopService(i);
}
});
}
}
No comments:
Post a Comment