小编Dou*_*aro的帖子

Android - 尝试在空对象引用上调用虚方法'void android.view.View.getBoundsOnScreen(android.graphics.Rect)'

我有一个简单的地址表格,如下所示:

Java的:

public class NewAddressActivity extends AppCompatActivity {

private TextInputLayout mStreetLayout;
private TextInputLayout mNumberLayout;
private TextInputLayout mNeighborhoodLayout;
private TextInputLayout mCityLayout;
private TextInputLayout mStateLayout;
private TextInputLayout mCepLayout;
private TextInputLayout mPhoneLayout;
private EditText mStreetText;
private EditText mNumberText;
private EditText mComplementText;
private EditText mNeighborhoodText;
private EditText mCityText;
private EditText mStateText;
private EditText mCepText;
private EditText mPhoneText;

private Address mAddressEditing;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_new_address);

    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
    }

    mStreetLayout = findViewById(R.id.street_layout);
    mNumberLayout = …
Run Code Online (Sandbox Code Playgroud)

android android-view

44
推荐指数
3
解决办法
2万
查看次数

使用LIKE查询无法使用GreenDAO

我有一个表,其中一列是一个包含三个字符的字符串,每个字符的值为0或1.我想根据情况选择这些行.

我想执行这样的查询:

SELECT * FROM Item WHERE group_type LIKE ?
Run Code Online (Sandbox Code Playgroud)

?可以是100或101或011或111或001.组合为0和1三个字符.

我正在尝试使用LIKE进行查询

WhereCondition where = null;
switch (condition) {
    case case1:
        where = ItemDao.Properties.GroupType.like("1%");
        break;
    case case2:
        where = ItemDao.Properties.GroupType.like("%1%");
        break;
    case case3:
        where = ItemDao.Properties.GroupType.like("%1");
        break;
}
List<Item> items = itemDao.queryBuilder().where(where).list();
Run Code Online (Sandbox Code Playgroud)

case1按预期返回以1开头的所有内容.case3按预期返回以1结尾的所有内容.case2正在归还一切!它不会在开始,中间或结束时满足价值.它正在归还一切.

case1和case3工作正常.但是,case2无法正常工作.这有什么问题吗?

sqlite android greendao

6
推荐指数
1
解决办法
386
查看次数

等一下 - Android

我希望我的程序在我的同时等待10秒,但它不起作用我尝试使用Thread.sleep(10000);但它不是10秒

while (true) {
    for (int i = 0; i < 2; i++) {
        for (int j = 0; j < 5; j++) {
            if (matrixVacancy[i][j] == 1) {
                completeParking(i, j, R.color.vaga_ocupada);
            } else {
                completeParking(i, j, R.color.cor_chao);
            }
        }
    }
    try {
        Thread.sleep(10000);
    } catch (InterruptedException ex) {
    }

    int a, b, c, d, e, f, g, h, i;

    a = (int) (Math.random() * 2); // indice i
    b = (int) (Math.random() * 5); // indice j …
Run Code Online (Sandbox Code Playgroud)

android wait

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

android ×3

android-view ×1

greendao ×1

sqlite ×1

wait ×1