-2

Bluetooth 対応の Android アプリを作成するプロジェクトに取り組んでいます。

アプリが動かない!残念ながら、Bluetooth led (my app name) has stoppedというポップアップ ブロックが表示され、ウィジェット画面に戻りました。マニフェスト用の XML ファイルで問題になりますか?

私のレイアウトXMLコード:

<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />

<Button
    android:id="@+id/buttonON"
    android:layout_width="100dp"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:text="Turn LED On" />

<Button
    android:id="@+id/buttonOFF"
    android:layout_width="100dp"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:text="Turn LED Off" />

4

1 に答える 1

0

これに対する最も一般的な答えは、スレッド内で実行するタスクに時間がかかりすぎるというものです。その結果、タスクが応答しなくなり、アプリケーションが強制終了されます。考えられる解決策は次のとおりです。

  1. アプリケーションのビジネス ロジックを改善する
  2. 別のスレッドでタスクを実行します
  3. 非同期アプローチを採用する
于 2012-10-01T04:05:29.540 に答える