小编adi*_*thi的帖子

以编程方式锁定Android设备

我一直试图通过程序锁定设备.但我还是找不到解决方案.我想通过程序锁定Android froyo2.2.我尝试过keyguardmanager和DeviceAdminManager.

我的应用是远程锁定设备.收到带有某些代码字的消息后,它会锁定电话.我发现很多Api_demo程序作为解决方案,但我不能单独提取锁定代码并找到解决方案.

android locking android-emulator device-admin

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

检索特定联系人组

我想检索联系人详细信息及其所属的组.我得到了代码来列出手机中的所有联系人组.

Cursor groupC = getContentResolver().query(
    ContactsContract.Groups.CONTENT_URI, null, null, null, null); 

while (groupC.moveToNext()) { 
    String groupid =
        groupC.getString(groupC.getColumnIndex(ContactsContract.Groups._ID));
    Log.e("myTag", groupid); 
    String grouptitle =
        groupC .getString(groupC.getColumnIndex(ContactsContract.Groups.TITLE));
    Log.e("myTag", grouptitle);
}
groupC.close();
Run Code Online (Sandbox Code Playgroud)

然后我尝试使用其ID来查询特定联系人,但它始终显示There is no such column....

Cursor groupC = getContentResolver().query(
    ContactsContract.Groups.CONTENT_URI,
    null,
    ContactsContract.Contacts._ID+"= ?",
    new String[]{id},
    null);
Run Code Online (Sandbox Code Playgroud)

其中id是

Cursor cur = cr.query(
    ContactsContract.Contacts.CONTENT_URI,
    null,
    null,
    null,
    null);
id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
Run Code Online (Sandbox Code Playgroud)

如何使用特定联系人ID查询组?

android android-contacts

5
推荐指数
1
解决办法
1942
查看次数

想要以编程方式在联系人中创建新组

我想创建一个新的联系人组.我可以查询该组并显示所有组名但我不能在android中创建一个组我尝试创建联系人方法但没有创建...

ContentResolver cr = this.getContentResolver();
    groupValues = new ContentValues();
    Log.e("Group","start");
    groupValues.put(android.provider.Contacts.GroupMembership.GROUP_ID, 4);
    groupValues.put(android.provider.Contacts.GroupMembership.NAME, "Sriseshaa");
    groupValues.put(android.provider.Contacts.GroupMembership.PERSON_ID, 1);

    cr.insert(android.provider.Contacts.GroupMembership.CONTENT_URI, groupValues);
Run Code Online (Sandbox Code Playgroud)

android android-contacts

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

我们如何在java代码中更改按钮大小

我在 java 代码中创建了按钮,但无法更改按钮的大小。我使用了

            btn = new Button(Activity.this);
    btn.setText("\t\t" + lbl + "\t\t\t  ");
            btn.setBackgroundResource(R.drawable.blue_button);
    btn.setwidth(100);
Run Code Online (Sandbox Code Playgroud)

但没有用。知道吗?谢谢

android button

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