WEB开发网
开发学院手机开发Android 开发 Android 实例展现如何不同程序间的Serivce调用 阅读

Android 实例展现如何不同程序间的Serivce调用

 2010-09-15 00:10:00 来源:WEB开发网   
核心提示:Bundle b = new Bundle();b.putString("pushdata1", ev1.getText().toString());b.putString("pushdata2", ev2.getText().toString());// demoService

Bundle b = new Bundle();

b.putString("pushdata1", ev1.getText().toString());

b.putString("pushdata2", ev2.getText().toString());

// demoService.putExtras(b);

demoService2.putExtras(b);

startService(demoService2);

// bindService(demoService2, sc, Context.BIND_AUTO_CREATE);

// startService(demoService2);

// startService(demoService2);

}

});

bstop.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View v) {

// Intent demoService = new Intent(ServiceActivity.this,

// DemoService.class);

Intent demoService2 = new Intent("com.shinestudio.demo.demoservice");

// unbindService(sc);

// stopService(demoService2);

// if(sc!=null)

// unbindService(sc);

// stopService(demoService2);

// unbindService(sc);

stopService(demoService2);

}

});

tv = (TextView) findViewById(R.id.tv);

bget = (Button) findViewById(R.id.b_get);

bget.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View v) {

if (dsb != null) {

try {

tv.setText(dsb.getPushString());

} catch (RemoteException e) {

e.printStackTrace();

}

}

}

});

bset = (Button) findViewById(R.id.b_set);

bset.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View v) {

if (dsb != null) {

try {

dsb.setPushString(ev2.getText().toString());

} catch (RemoteException e) {

e.printStackTrace();

}

}

}

});

}

}

IDemoServiceBinder.aidl

上一页  1 2 3 4 5 6 7 8  下一页

Tags:Android 实例 展现

编辑录入:coldstar [复制链接] [打 印]
赞助商链接