我已经创建了一个从主活动调用的服务,并传递一个简单的变量来访问服务内部并向屏幕干杯.我似乎无法找到从服务内部访问变量的正确代码.任何帮助将不胜感激.谢谢.
从按钮单击侦听器内部调用服务的主Activity:
@Override
public void onClick(View v) {
Intent eSendIntent = new Intent(getApplicationContext(), eSendService.class);
eSendIntent.putExtra("extraData", "somedata");
startService(eSendIntent);
}
Run Code Online (Sandbox Code Playgroud)
eSendService服务类代码:
public class eSendService extends Service {
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
// This is the code that I am struggling with. Not sure how to access the
// variable that was set in the intent. Please advise.
// The below code …Run Code Online (Sandbox Code Playgroud) 我在Drupal 7中有一个查询正在搜索自定义表:
$query5 = "SELECT COUNT(reservation_id) as rcount5, reservation_id FROM {reservations} WHERE resource_id = :resource_id AND reservation_date = :reservation_date AND start_time BETWEEN :start_time AND :end_time";
$result5 = db_query($query5, array(':resource_id' => $resource_id, ':reservation_date' => $reservation_date, ':start_time' => $start_time, ':end_time' => $end_time));
Run Code Online (Sandbox Code Playgroud)
查询无效,因为我认为它没有正确识别BETWEEN函数并返回end_time,因为它存在.有没有办法显示drupal或db api这是BETWEEN语句?谢谢.