私はアンドロイド用のkivyのpythonを使ってアンドロイド用のpython bluetoothライブラリを作成しようとしています。 jniusモジュールからautoclassを使ってJavaクラスをインポートします。しかし、関数fetchUuidsWithSdp()を呼び出してフェッチされたuuidのACTION_UUIDインテントをチェックすると、間違ったオブジェクトを取得することができます。私が使用しているコードは次のとおりです。なぜandroid ACTION_UUIDが間違ったオブジェクトを返します
elif action == ACTION_UUID:
print("....... ACTION_UUID .......")
extras = intent.getExtras()
fetchedUUIDs = extras.get(EXTRA_UUID)
# fetchedUUIDs = intent.getParcelableArrayExtra(EXTRA_UUID)
print("fetchedUUIDs object type is: ..............")
print (fetchedUUIDs)
for u in fetchedUUIDs:
print u.toString()
ので、私はADBのコンソールで、次のプリントを出す:
I/python (30971): ....... ACTION_UUID .......
I/python (30971): fetchedUUIDs object type is: ..............
I/python (30971): [<android.os.Parcelable at 0x7c1f2600 jclass=android/os/Parcelable jself=<LocalRef obj=0x20f00dfa at 0x79f7bab0>>, <android.os.Parcelable at 0x7c1
「fetchedUUIDs」のオブジェクト・タイプを示している「android.os.Parcelableです'ParcelUuid'リストのリストを入力してください。私はのtoString()を呼び出すと、私は次のトレースを取得する:
I/python (30971): Traceback (most recent call last):
I/python (30971): File "jnius/jnius_proxy.pxi", line 47, in jnius.jnius.PythonJavaClass.invoke (jnius/jnius.c:24931)
I/python (30971): File "jnius/jnius_proxy.pxi", line 73, in jnius.jnius.PythonJavaClass._invoke (jnius/jnius.c:25609)
I/python (30971): File "/home/tito/code/python-for-android/build/python-install/lib/python2.7/site-packages/android/broadcast.py", line 18, in onReceive
I/python (30971): File "main.py", line 235, in on_broadcast
I/python (30971): print u.toString()
I/python (30971): AttributeError: 'android.os.Parcelable' object has no attribute 'toString'
私のコードで間違った任意のものがありますか?どんな助けでも大歓迎です。