Monday, 9 September 2013

Bluetooth app stopped unexpectedly

Bluetooth app stopped unexpectedly

I have been working on it for a time being. I even went through android
doc but could not sort out my problem. Everything runs fine and I get no
error in the Logcat either. But, emulator display the output saying ,
program stopped unexpectedly? Anyone plz help??
main_activity.java
package com.bluetoothenabelling;
import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog;
import android.bluetooth.BluetoothAdapter;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity {
private static final int REQUEST_ENABLE_BT = 0;
private static final int madapter =0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button b1 = (Button) findViewById(R.id.button1);
BluetoothAdapter madaptoer = BluetoothAdapter.getDefaultAdapter();
if (madaptoer == null) {
AlertDialog.Builder alert = new
AlertDialog.Builder(MainActivity.this);
alert.setMessage("This deivce does not support bluetoot");
}
if(!madaptoer.isEnabled()){
Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
startActivityForResult(intent, REQUEST_ENABLE_BT);
}
}
}
Manifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.bluetoothenabelling"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.bluetoothenabelling.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
String.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">BluetoothEnabelling</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="button1">Check for Bluetooth Enabling</string>
</resources>
[2013-09-09 23:25:46 - Bluetooth Enabelling] Android Launch!
[2013-09-09 23:25:46 - Bluetooth Enabelling] adb is running normally.
[2013-09-09 23:25:46 - Bluetooth Enabelling] Performing
com.bluetoothenabelling.MainActivity activity launch
[2013-09-09 23:25:53 - Bluetooth Enabelling] Uploading Bluetooth
Enabelling.apk onto device 'emulator-5554'
[2013-09-09 23:25:53 - Bluetooth Enabelling] Installing Bluetooth
Enabelling.apk...
[2013-09-09 23:26:08 - Bluetooth Enabelling] Success!
[2013-09-09 23:26:08 - Bluetooth Enabelling] Starting activity
com.bluetoothenabelling.MainActivity on device emulator-5554
[2013-09-09 23:26:10 - Bluetooth Enabelling] ActivityManager: Starting:
Intent { act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER]
cmp=com.bluetoothenabelling/.MainActivity }
[2013-09-09 23:32:47 - Bluetooth Enabelling] ------------------------------
[2013-09-09 23:32:47 - Bluetooth Enabelling] Android Launch!
[2013-09-09 23:32:47 - Bluetooth Enabelling] adb is running normally.
[2013-09-09 23:32:47 - Bluetooth Enabelling] Performing
com.bluetoothenabelling.MainActivity activity launch
[2013-09-09 23:32:54 - Bluetooth Enabelling] Launch canceled!
[2013-09-09 23:33:04 - Bluetooth Enabelling] ------------------------------
[2013-09-09 23:33:04 - Bluetooth Enabelling] Android Launch!
[2013-09-09 23:33:04 - Bluetooth Enabelling] adb is running normally.
[2013-09-09 23:33:04 - Bluetooth Enabelling] Performing
com.bluetoothenabelling.MainActivity activity launch
[2013-09-09 23:33:07 - Bluetooth Enabelling] Uploading Bluetooth
Enabelling.apk onto device 'emulator-5554'
[2013-09-09 23:33:07 - Bluetooth Enabelling] Installing Bluetooth
Enabelling.apk...
[2013-09-09 23:33:19 - Bluetooth Enabelling] Success!
[2013-09-09 23:33:19 - Bluetooth Enabelling] Starting activity
com.bluetoothenabelling.MainActivity on device emulator-5554
[2013-09-09 23:33:21 - Bluetooth Enabelling] ActivityManager: Starting:
Intent { act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER]
cmp=com.bluetoothenabelling/.MainActivity }
[2013-09-09 23:34:32 - Bluetooth Enabelling] ------------------------------
[2013-09-09 23:34:32 - Bluetooth Enabelling] Android Launch!
[2013-09-09 23:34:32 - Bluetooth Enabelling] adb is running normally.
[2013-09-09 23:34:32 - Bluetooth Enabelling] Performing
com.bluetoothenabelling.MainActivity activity launch
[2013-09-09 23:34:35 - Bluetooth Enabelling] Launch canceled!
[2013-09-09 23:34:39 - Bluetooth Enabelling] ------------------------------
[2013-09-09 23:34:39 - Bluetooth Enabelling] Android Launch!
[2013-09-09 23:34:39 - Bluetooth Enabelling] adb is running normally.
[2013-09-09 23:34:39 - Bluetooth Enabelling] Performing
com.bluetoothenabelling.MainActivity activity launch
[2013-09-09 23:34:48 - Bluetooth Enabelling] Launching a new emulator with
Virtual Device 'Samsung'
[2013-09-09 23:34:59 - Bluetooth Enabelling] New emulator found:
emulator-5554
[2013-09-09 23:34:59 - Bluetooth Enabelling] Waiting for HOME
('android.process.acore') to be launched...
[2013-09-09 23:36:17 - Bluetooth Enabelling] HOME is up on device
'emulator-5554'
[2013-09-09 23:36:17 - Bluetooth Enabelling] Uploading Bluetooth
Enabelling.apk onto device 'emulator-5554'
[2013-09-09 23:36:18 - Bluetooth Enabelling] Installing Bluetooth
Enabelling.apk...
[2013-09-09 23:38:12 - Bluetooth Enabelling] Success!
[2013-09-09 23:38:12 - Bluetooth Enabelling] Starting activity
com.bluetoothenabelling.MainActivity on device emulator-5554
[2013-09-09 23:38:17 - Bluetooth Enabelling] ActivityManager: Starting:
Intent { act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER]
cmp=com.bluetoothenabelling/.MainActivity }

No comments:

Post a Comment