小编nik*_*yil的帖子

Android相机预览回调和mediarecorder录制视频

我想创建一个应用程序,它必须记录视频(使用媒体记录器)和录制的视频需要格式化(使用相机).
我创建了下面显示的示例代码,但是当从菜单按下startrecording按钮时显示错误.它显示强制关闭错误.但previewcallback没有错误.我的代码如下所示

  package buffer.video;
    import android.app.Activity;
    import android.os.Bundle;
    import java.io.IOException;  
    import android.app.Activity;
    import android.hardware.Camera;
    import android.hardware.Camera.PreviewCallback;
    import android.media.MediaRecorder;
    import android.os.Bundle;
    import android.util.Log;
    import android.view.Menu;
    import android.view.MenuInflater;
    import android.view.MenuItem;
    import android.view.SurfaceHolder;
    import android.view.SurfaceView;
    import android.widget.Toast;

    public class VofoVideoToBufferActivity extends Activity implements SurfaceHolder.Callback,
    Camera.AutoFocusCallback {

    private SurfaceView preview;
    private SurfaceHolder previewHolder;

    private MediaRecorder mRecorder;
    private Camera mCamera;
    private boolean mPreviewRunning = false;
    private boolean mCaptureFrame = false;


    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Log.e("", "Begin onCreate");
    setContentView(R.layout.main);

    preview = (SurfaceView) findViewById(R.id.surfaceView1);
    previewHolder …
Run Code Online (Sandbox Code Playgroud)

android android-camera android-mediarecorder

10
推荐指数
1
解决办法
8223
查看次数

alertdialog里面的AlertDialog

我想一个alertdialog.But无法看到第二alertdialog..please帮助我在这里内添加alertdialog是我的代码所示

AlertDialog alertDialog = new AlertDialog.Builder(myclass.this).create();
alertDialog.setTitle("First alert");
alertDialog.setMessage("first alert press");
alertDialog.setButton("ok", new DialogInterface.OnClickListener() {
    public void onClick(DialogInterface dialog, int which) {
        // here you can add functions
        dialog.cancel();

        AlertDialog alertDialog1 = new AlertDialog.Builder(myclass.this).create();
        alertDialog1.setTitle("second alert dialog");
        alertDialog1.setMessage("second alert dialog details");
        alertDialog1.setButton("Scan Another", new DialogInterface.OnClickListener() {
                           public void onClick(DialogInterface dialog, int which) {
}}); }
Run Code Online (Sandbox Code Playgroud)

android android-alertdialog

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

Android ZXing实现

我用ZXing源代码创建了一个项目.这很好.

我更改了包名后

 com.google.zxing.client.android 
Run Code Online (Sandbox Code Playgroud)

 com.google.zxing.client.android.vofox
Run Code Online (Sandbox Code Playgroud)

但它显示真实设备中的错误(HTC Wildfire)

它在eclipse模拟器中没有错误.我的logcat文件如下所示.

08-23 17:13:58.899: ERROR/AndroidRuntime(9816): FATAL EXCEPTION: main
08-23 17:13:58.899: ERROR/AndroidRuntime(9816): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.zxing.client.android.vofox/com.google.zxing.client.android.vofox.CaptureActivity}: android.view.InflateException: Binary XML file line #26: Error inflating class com.google.zxing.client.android.ViewfinderView
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2781)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2797)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.app.ActivityThread.access$2300(ActivityThread.java:135)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2132)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.os.Looper.loop(Looper.java:143)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at android.app.ActivityThread.main(ActivityThread.java:4914)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at java.lang.reflect.Method.invokeNative(Native Method)
08-23 17:13:58.899: ERROR/AndroidRuntime(9816):     at java.lang.reflect.Method.invoke(Method.java:521)
08-23 …
Run Code Online (Sandbox Code Playgroud)

android qr-code barcode-scanner zxing

0
推荐指数
1
解决办法
6965
查看次数