这是我的代码的缩写版本。我应该澄清" initializeGrid()"表现得很好,所以为了简洁起见,我没有把它包括在内。我想得到" threadFunction()"在args中打印值但它不起作用。请帮忙!
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.0-beta.2/angular.min.js"></script>
</head>
<body>
<div class="row">
<!-- First Panel -->
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-heading">First Panel</div>
<div class="panel-body">
<table class="table table-striped">
<thead>
<tr>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr>
<td><a data-toggle="collapse" href="#secondPanel">open second panel</a> </td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Second Panel -->
<div class="col-md-4">
<div class="panel panel-default panel-collapse collapse" id="secondPanel">
<div class="panel-heading">Second Panel</div>
<div class="panel-body">
<table class="table table-striped">
<thead>
</thead>
<tbody>
<button type="button" class="btn btn-primary" data-toggle="collapse" href="#thirdPanel">Reply</button>
</tbody>
</table>
</div>
</div>
</div>
<!-- Third Panel -->
<div class="col-md-4">
<div class="panel panel-default panel-collapse collapse" id="thirdPanel">
<div class="panel-heading">Third Panel</div>
<div class="panel-body">
<table class="table table-striped">
<thead>
</thead>
<tbody>
<div class="well well-sm">some text</div>
</tbody>
</table>
</div>
</div>
</div>
</div>
</body>
</html>
答案 0 :(得分:2)
调用<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
后,E/AndroidRuntime: FATAL EXCEPTION: main
Process: degaming.bewegungsmelder, PID: 12580
java.lang.RuntimeException: takePicture failed
at android.hardware.Camera.native_takePicture(Native Method)
at android.hardware.Camera.takePicture(Camera.java:1711)
at degaming.bewegungsmelder.MainActivity$1.onClick(MainActivity.java:36)
at android.view.View.performClick(View.java:5642)
at android.view.View$PerformClick.run(View.java:22338)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6209)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
函数会立即返回。
当main()
返回时,进程退出并终止,同时生成每个线程。
您需要添加pthread_create()
调用以等待线程终止。根据{{3}}:
main()
函数将暂停执行调用 线程直到目标pthread_join()
终止
像这样:
pthread_join()