我创建了一个Android小部件.
在运行Android 4.4.4的Genymotion Nexus 4模拟器中,一切运行良好.
在运行Android 4.4.4的Nexus 4设备上,我将小部件放在主屏幕上,然后变成了Google App小部件.
然后它变成我的小部件,然后再次进入Google App小部件,依此类推.它执行此操作直到我从主屏幕中删除小部件.
此外,我使用parse.com作为在线存储,在我的手机上似乎没有获得数据.我无法确切地说出因为小部件不断变化.
我的小部件包含3个文件.
一个扩展应用程序类:
public class MyApp extends Application
{
    private MyModel model;
     @Override
    public void onCreate() {
        Parse.enableLocalDatastore(this);
        ParseObject.registerSubclass(GdbdData.class);
        Parse.initialize(this, "-", "-");
        if(model == null) {
            Intent intent = new Intent(this,GdbdWidgetProvider.class);
            intent.setAction(WidgetUtils.WIDGET_REFRESH_STORAGE);
            intent.putExtra("userId",123);
            sendBroadcast(intent);
        }
        super.onCreate();
    }
Run Code Online (Sandbox Code Playgroud)
一个WidgetProvider:
@Override
public void onReceive(Context context, Intent intent) {
    super.onReceive(context, intent);
    final String action = intent.getAction();
    if (action.equals(WidgetUtils.WIDGET_REFRESH_STORAGE))
    {
        MyApp app = ((MyApp)context.getApplicationContext());
        int userId = intent.getIntExtra("userId",0);
        TryGetModelFromRemoteStorage(userId,context);
    }
}
static void …Run Code Online (Sandbox Code Playgroud) 为hmtl5画布中显示的非常大的数据提供滚动和本机滚动条的推荐方法是什么?
我需要显示128000x128000像素的数据.使用宽度/高度设置为128000的画布不是一个选项,因为它会使用大量的RAM(根据我的快速计算,大约61 GB).
所以我需要一种为HTML5画布提供自定义滚动条的方法.