chinnytp / android-bluetooth

Automatically exported from code.google.com/p/android-bluetooth
1 stars 0 forks source link

LocalBluetoothDevice.initLocalDevice(this) <= throws Null Point Excption!! #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add Jar - AndroidBluetoothAPI_0.3.jar
2. import it.gerdavax.android.bluetooth.LocalBluetoothDevice;
3. try {
    localBD = LocalBluetoothDevice.initLocalDevice(this);
} catch (Exception e) {
    Log.w("TEST","create Error: "+e.toString());
}

is printed

"create Error: java.lang.NullPointException"

What is the expected output? What do you see instead?
Not null...

What version of the product are you using? On what operating system?
Window xp (sp3) and eclipse, android 7 based.

Please provide any additional information below.

I need your help, please. 

Thank you!!

* attach some code-------

package test.test;

import it.gerdavax.android.bluetooth.LocalBluetoothDevice;
import it.gerdavax.android.bluetooth.RemoteBluetoothDevice;

import java.util.Set;

import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.Toast;

public class TestActivity extends Activity implements OnClickListener {
    /** Called when the activity is first created. */

    private static final int REQUEST_ENABLE_BT = 2;
    private BluetoothAdapter mBTAdap;
    private Set<android.bluetooth.BluetoothDevice> pairedDevices;
    private LocalBluetoothDevice localBD;

    ImageButton setB = null;
    ImageButton set2 = null;
    EditText tView = null;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        tView = (EditText)findViewById(R.id.text);
        setB = (ImageButton)findViewById(R.id.set);
        setB.setOnClickListener(this);
        set2 = (ImageButton)findViewById(R.id.set2);
        set2.setOnClickListener(this);

        try {
            localBD = LocalBluetoothDevice.initLocalDevice(this);
        } catch (Exception e) {
            Log.w("TESTT","create E: "+e.toString());
        }
    }
.............................

Original issue reported on code.google.com by kajahaya@gmail.com on 21 Jun 2010 at 7:53

GoogleCodeExporter commented 9 years ago
And, I used Android 2.1 Samsung M100S Phone-.

Original comment by kajahaya@gmail.com on 21 Jun 2010 at 8:00

GoogleCodeExporter commented 9 years ago
Having the same problem on Windows 7 x64, 2.2.1 android OS :(

Original comment by goczanpe...@gmail.com on 1 Jun 2011 at 10:11

GoogleCodeExporter commented 9 years ago
Same problem on 1.5, 1.6 emulators and 2.3.4 Google Nexus S. Has anyone found a 
solution yet?

Original comment by klein.vo...@gmail.com on 18 Jun 2011 at 3:45

GoogleCodeExporter commented 9 years ago
Hi, I have the same problem... :(
Anyone managed to solve this?
I am using Android 2.1!

Original comment by gkop...@gmail.com on 25 Jun 2011 at 12:54

GoogleCodeExporter commented 9 years ago
This API has been designed for Android 1.x, which has no official Bluetooth 
support for developers. If you need Bluetooth on Android 2.x, please refer to 
the official API. Otherwise, if you need to support both Android 1.x and 
Android 2.x you should have a look to "Easy Bluetooth" which is part of this 
project but it has not been included in the JAR distribution (you can find it 
browsing the SVN repository at 
http://code.google.com/p/android-bluetooth/source/browse 
/#svn%2Fbranches%2Ftwo_dot_o%2FAndroidBluetoothLibrary). Finally, the Bluetooth 
library does not work on 1.x emulator due to platform limitations.

Original comment by gerda...@gmail.com on 26 Jun 2011 at 4:42