android getAppWidgetIds failed, what wrong?
- by bright
I want to use following code to get a widget id, but getAppWidgetIds always return an empty array, the num is alway 0, what wrong?
Thanks!
public class test extends Activity implements OnTouchListener {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
.....
AppWidgetManager mAppWidgetManager;
AppWidgetHost mAppWidgetHost;
mAppWidgetManager = AppWidgetManager.getInstance(this.getApplicationContext());
ComponentName THIS_APPWIDGET =new ComponentName("com.android.music", "com.android.music.MediaAppWidgetProvider");
int[] appWidgetId=mAppWidgetManager.getAppWidgetIds(THIS_APPWIDGET);
int num=appWidgetId.length;