2010-12-01 70 views

回答

3
RemoteViews views = new RemoteViews(context.getApplicationContext(), R.layout.main_view); 

Intent intent = new Intent(context, InputBroadcastReceiver.class); // receiver class 
intent.putExtra(EXTRA_ID, id); // some extras 

PendingIntent pendingIntent = PendingIntent.getBroadcast(context, 0, intent,PendingIntent.FLAG_UPDATE_CURRENT);    views.setOnClickPendingIntent(R.id.my_button, pendingIntent); 

然後覆蓋InputBroadcastReceiver的方法的onReceive和享受您的投入;)

BroadcastReceivers被解釋here

相關問題