私は2つのパッケージを持っています。1 つ目は携帯電話の Bluetooth ソケット用で、2 つ目はアプリの他のアクティビティを処理します。
私がやりたかったのは、.remote.btconnection (最初の) パッケージから DeviceListActivity を呼び出し、それを必要とする 2 番目のパッケージのすべてのアクティビティで使用することです。そのアクティビティを呼び出すインフレータメニューをタップするたびに、力が入り続けます。
(マニフェストで DeviceListActivity を正しく宣言したかどうかもよくわかりません。)
マニフェストで宣言した方法(最初のパッケージのクラス)は次のとおりです。
<activity
android:name="com.luugiathuy.apps.remote.btconnection.DeviceListActivity"
android:label="@string/select_device"
android:theme="@android:style/Theme.Dialog"
android:configChanges="orientation|keyboardHidden"
android:screenOrientation="portrait" >
</activity>
2番目のパッケージのクラス/アクティビティで呼び出すコードは次のとおりです。
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.scan:
// Launch the DeviceListActivity to see devices and do scan
Intent serverIntent = new Intent(GetFrequencyActivity.this, DeviceListActivity.class);
startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE);
return true;
どこを間違えたかわかりますか?ありがとう!