我正在研究Android 2.0,我正在尝试接收所有联系人的列表.
由于android.provider.Contacts.People已过时,我不得不使用android.provider.ContactsContract,但我不能找到如何使用适当的例子(例如:检索电话簿的所有联系人的列表).
谁知道在哪里可以找到这样的例子?
我有一些代码可以扩展服务并在Android上记录onSensorChanged(SensorEvent事件)加速计传感器读数.我希望能够记录这些传感器读数,即使设备关闭(我对电池寿命非常小心,并且在运行时显而易见).虽然屏幕上的日志工作正常,但在2.0.1 Motorola Droid和2.1 Nexus One上.
但是,当手机进入休眠状态时(通过按下电源按钮),屏幕关闭,onSensorChanged事件停止传送(每隔N次使用一次Log.e消息进行验证onSensorChanged).
该服务获取wakeLock以确保它在后台运行; 但是,它似乎没有任何影响.我已经尝试了各种各样的PowerManager.唤醒锁,但它们似乎都不重要.
_WakeLock = _PowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag");
_WakeLock.acquire();
关于在屏幕关闭时你是否能真正从传感器获取数据的报道相互矛盾......任何人都对更现代版的Android(Eclair)和硬件有任何经验吗?
这似乎表明它在Cupcake中工作:http: //groups.google.com/group/android-developers/msg/a616773b12c2d9e5
PS:完全相同的代码在G1上的1.5中按预期工作.当屏幕关闭,应用程序在后台等时,记录继续.
我正在寻找Android 2.0开发的单一书籍来源.虽然我可能对一般的Android开发书感到满意,但是一本涵盖2.0功能的书是理想的.
什么是最好的Android 2.0书籍,或即将推出?
我有以下布局文件,后面有一个GridView和ImageView后面的布局文件.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="#FFFFFF">
    <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="bottom|right"
            android:layout_marginRight="-70dp"
            android:layout_marginBottom="-50dp"
            android:src="@drawable/s_background"/>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent">
        <GridView xmlns:android="http://schemas.android.com/apk/res/android"
                  android:id="@+id/gridview"
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:columnWidth="90dp"
                  android:numColumns="auto_fit"
                  android:verticalSpacing="10dp"
                  android:horizontalSpacing="10dp"
                  android:stretchMode="columnWidth"
                  android:gravity="center"/>
    </LinearLayout>
</FrameLayout>
这是我用于网格的每个"单元格"中的实际项目的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="match_parent"
              android:layout_height="match_parent">
    <TextView
            android:id="@+id/cardInGrid"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:singleLine="true"
            android:textSize="40sp"
            android:textColor="#660099"
            android:typeface="serif"/>
</LinearLayout>
我现在在设备上看到以下内容:

是否有任何方法可以使GridView中的每个项目更大,所以它适合屏幕的大小,我在显示屏的底部没有未使用的空白区域?
这在模拟器上工作正常,但在设备上屏幕分辨率更高,因此在底部获得空白区域.
非常感谢
我已经在我的应用程序中实现了pull刷新,它在2.2中运行良好,但在2.0中却没有.
我在2.0中找不到方法'smoothScrollBy()'.
任何人都可以给我这个问题的解决方案或任何其他选择?我怎样才能在iphone中实现刷新功能?
谢谢..