Hi, I have following code to add a widget on custom home screen . when I run this code it doesn't show 'Search Widget' on Android 2.1 but same code show 'Search Widget' on Android 2.2 .
Can any one let me know why it is like this? and how I can add 'Search Widget' for 2.1 on Eclair as well. protected void doWidgetPick() { int appWidgetId = this.mAppWidgetHost.allocateAppWidgetId(); Intent pickIntent = new Intent(AppWidgetManager.ACTION_APPWIDGET_PICK); pickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); /* custom extra that has to be there or else NPE will happen due to android bug */ //this is pulled from the Launcher source, I just changed a few things as it's just a dummy entry at this point ArrayList<AppWidgetProviderInfo> customInfo = new ArrayList<AppWidgetProviderInfo>(); AppWidgetProviderInfo info = new AppWidgetProviderInfo(); info.provider = new ComponentName(getPackageName(), "XXX.YYY"); info.label = "i love android"; info.icon = R.drawable.icon; customInfo.add(info); pickIntent.putParcelableArrayListExtra( AppWidgetManager.EXTRA_CUSTOM_INFO, customInfo); ArrayList<Bundle> customExtras = new ArrayList<Bundle>(); Bundle b = new Bundle(); b.putString("custom_widget", "search_widget"); customExtras.add(b); pickIntent.putParcelableArrayListExtra( AppWidgetManager.EXTRA_CUSTOM_EXTRAS, customExtras); /* that's a lot of lines that are there for no function at all */ // start the pick activity startActivityForResult(pickIntent, REQUEST_PICK_APPWIDGET); //because we've defined ourselves as a singleTask activity, it will allow this intent to be part of the task } Note: I have take above code sample from a web site. Please suggest if you know any specific information which might be helpful. Regards, varinaq -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en