English 中文(简体)
∗∗∗∗∗
原标题:LED flashlight on Galaxy Nexus controllable by what API?

So many LED flashlight API questions for Android. I m afraid to ask yet another, but here goes..

利用受审判和真正的讲卫生运动 我能对我的三星银河SII感到满意,并看到LED闪电。 在我的朋友Galaxy Nexus上,没有这样的uck。 我的其他朋友也不是Droid X。

I m noticing for a not insignificant number of devices specific native IOCTL calls seem to be required. Is this the case for the Galaxy Nexus? How do I find a reference to program it?

我正在采用标准FLASH_MODE_TORCH/“flash-mode”=“torch”,即启动Preview()链。

Kind本标准文本似乎完全如此普及。

问题回答

我发现的是,有些装置需要表面上听从LED。

SurfaceView preview = (SurfaceView) findViewById(R.id.PREVIEW);
SurfaceHolder mHolder = preview.getHolder();
mHolder.addCallback(this);
Camera mCamera = Camera.open();
mCamera.setPreviewDisplay(mHolder);

// Turn on LED  
Parameters params = mCamera.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_TORCH);
mCamera.setParameters(params);      
mCamera.startPreview();

...

// Turn off LED
Parameters params = mCamera.getParameters();
params.setFlashMode(Parameters.FLASH_MODE_OFF);
mCamera.setParameters(params);
mCamera.stopPreview();
mCamera.release();

你的活动需要执行水稻。 反馈:

public void surfaceChanged(SurfaceHolder holder, int format, int width,
        int height) {}

public void surfaceCreated(SurfaceHolder holder) {
    mHolder = holder;
    mCamera.setPreviewDisplay(mHolder);
}

public void surfaceDestroyed(SurfaceHolder holder) {
    mCamera.stopPreview();
    mHolder = null;
}

The surfaceview has to be visible, android:visibility="invisible" or a height and width of 0 won t work. Unfortunately I didn t find a good solution to hide it, so I just gave it a size of 1x1dip and positioned it underneath a button..

**(对上述段落加以扩充[但认为其有用]不够回答] 在你目前内容观点的XML中,你希望:

<SurfaceView
    android:id="@+id/PREVIEW"
    android:layout_width="1dip"
    android:layout_height="1dip"/>

如果你在“亲属关系”内有这种联系,那么你也能够使ParentLeft/Bottom在一角 t。 这种方法适用于我的银河Nexus,但它为Droid X(更新621条,任何一条路)提出了一个已知的问题(电话线),并且没有处理地雷问题。 答案大, t!





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签