我只是想在安卓的Activity 中创建一个简单的广播,但它不工作。/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent i = new Intent("android.intent.action.UMS_CONNECTED");
IntentFilter filter = new IntentFilter();
filter.addAction("android.intent.action.UMS_CONNECTED");
receiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(getApplicationContext(),"connected", Toast.LENGTH_LONG).show();
}
};
registerReceiver(receiver, filter);
}
}
XML<?xml version="1.0" encoding="utf-8"?>
package="usb.usbd"
android:versionCode="1"
android:versionName="1.0">
android:label="@string/app_name">
屏幕上显示的屏幕显示,但是on不显示。 Xoom通过USB连接,因此它应该显示 toast/