小编Mic*_*ael的帖子

如何检测屏幕旋转

我有一个显示指南针的活动,我需要知道屏幕的方向以正确旋转针.我需要区分90°和270°旋转才能正确处理.

当我旋转屏幕(至少在我的Nexus S上)时,onCreate会调用活动,例如当我从纵向模式旋转到横向模式时.当我从一个横向模式旋转到另一个横向边缘凸起时,onCreate()会被调用两次(一次用于纵向,一次用于目标横向模式).

但是,当我以底边向上旋转时,屏幕旋转180°并且onCreate不会被调用.在这种情况下会有被触发的事件吗?

android screen-rotation

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

无法删除GAE文件

我试图在使用上传中断后删除文件

final FileService fileService = FileServiceFactory.getFileService();
fileService.delete(file);
Run Code Online (Sandbox Code Playgroud)

但我得到:

java.lang.UnsupportedOperationException: File \/blobstore\/writable:AD8BvukH[...]qau-Bb7AD does not have a finalized name
Run Code Online (Sandbox Code Playgroud)

当我尝试使用完成文件时

FileWriteChannel writeChannel = fileService.openWriteChannel(file, true);
writeChannel.closeFinally();
Run Code Online (Sandbox Code Playgroud)

然后openWriteChannel()失败了

com.google.appengine.api.files.FinalizationException
[...]
Caused by: com.google.apphosting.api.ApiProxy$ApplicationException: ApplicationError: 101: 
Run Code Online (Sandbox Code Playgroud)

ApplicationError 101的含义是什么?如何正确删除文件?

java google-app-engine google-cloud-datastore

8
推荐指数
1
解决办法
280
查看次数

继续不能在循环外使用

我收到错误消息"继续不能在循环外使用",但它在一个循环内我认为?

public void run() {
            // TODO Auto-generated method stub
            while (isItOK == true);{
                //perform canvas drawing
                if (!holder.getSurface().isValid()){
                    continue;
                }
                Canvas c = holder.lockCanvas();
                c.drawARGB(255, 150, 150, 10);
                holder.unlockCanvasAndPost(c);
Run Code Online (Sandbox Code Playgroud)

java

-4
推荐指数
1
解决办法
2898
查看次数