我有一个问题,Button从我的内部抓住我的s和其他元素PopupWindow,使用debugger它只是报告回来null?
private void initiatePopupWindow()
{
try
{
// We need to get the instance of the LayoutInflater
LayoutInflater inflater = (LayoutInflater) LoginActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.activity_register,(ViewGroup)
findViewById(R.id.popup_element));
pwindo = new PopupWindow(layout, 600, 900, true);
pwindo.showAtLocation(layout, Gravity.CENTER, 0, 0);
btnReg = (Button) findViewById(R.id.btnReg);
inputName = (EditText) findViewById(R.id.name);
inputDOB = (DatePicker) findViewById(R.id.dob);
String name = inputName.getText().toString();
btnReg.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v)
{
if ( ( !inputName.getText().toString().equals("")) &&
( getAge(inputDOB.getDayOfMonth(), inputDOB.getMonth(), inputDOB.getYear()) …Run Code Online (Sandbox Code Playgroud) 我正在使用此代码尝试检索过去14小时内完成的步骤.
YApp myApp = (mYApp) ctx;
mGoogleApiClient = myApp.getMyUser();
mGoogleApiClient.reconnect();
Calendar cal = Calendar.getInstance();
Date now = new Date();
cal.setTime(now);
long endTime = cal.getTimeInMillis();
cal.add(Calendar.HOUR_OF_DAY, -16);
long startTime = cal.getTimeInMillis();
PendingResult<DataReadResult> pendingResult =
Fitness.HistoryApi.readData(mGoogleApiClient, new DataReadRequest.Builder()
.aggregate(DataType.TYPE_STEP_COUNT_DELTA, DataType.AGGREGATE_STEP_COUNT_DELTA)
.bucketByTime(1, TimeUnit.DAYS)
.setTimeRange(startTime, endTime, TimeUnit.MILLISECONDS)
.build());
DataReadResult dataReadResult = pendingResult.await();
DataSet ds = dataReadResult.getDataSet(DataType.AGGREGATE_STEP_COUNT_DELTA);
Run Code Online (Sandbox Code Playgroud)
我的datareadresult返回成功但是当我尝试将结果读入数据集时,我得到了这个错误
java.lang.IllegalArgumentException: Attempting to read data for com.google.step_count.delta, which was not requested
Run Code Online (Sandbox Code Playgroud)
我已经尝试过各种各样的DataTypes但每次都收到同样的错误,我做错了什么?!
我相信这应该很简单,但我似乎无法找到解决方案.
假设我有一个包含5个字段的表(id,颜色,大小,扫描,预期)
如何获得预期大于扫描的所有行?
我试过了
mydao.Property.Expected.gt(mydao.Property.Scanned).list()
Run Code Online (Sandbox Code Playgroud)
但是这会返回0行.使用LOG_SQL布尔我可以看到它正在查找属性字段,而不是字段的值.
D/greenDAO: Values for query: [0, de.greenrobot.dao.Property@33ecce97]
Run Code Online (Sandbox Code Playgroud) 我真的很努力使用sails.io和android打开套接字连接.我现在想要实现的只是在sails.js服务器的控制台中打印socketid.
Android方面:
我正在使用nkzwa的socket.io.client库(编译'com.github.nkzawa:socket.io-client:0.4.2')
这是我在AsyncTask里面的android中使用的代码:
private Socket mSocket;
{
try {
mSocket = IO.socket("http://192.168.0.80:3000/batches/");
} catch (URISyntaxException e) {}
}
@Override
protected Void doInBackground(Void... params) {
mSocket.connect();
mSocket.emit("getSocketID");
}
Run Code Online (Sandbox Code Playgroud)
我的批次控制器看起来像这样:
module.exports = {
getSocketID: function(req, res) {
if (!req.isSocket) return res.badRequest();
var socketId = sails.sockets.id(req.socket);
// => "BetX2G-2889Bg22xi-jy"
console.log(socketId)
return res.ok('My socket ID is: ' + socketId);
}
}
Run Code Online (Sandbox Code Playgroud)
在运行任务时,我认为我会在我的sails实例中输出控制台日志.
谁能看到我做错了什么?