Remove All Ads from XDA
Find Your Device:
Or Continue to Thread: [Q] Widget pick code not worki…
17th February 2014, 06:09 AM |#1  
OP Junior Member
Thanks Meter: 0
Sorry if I'm at wrong place to ask, I couldn't find other place I can ask this question.

There's a simple code that brings up widget list to let user select widget, and code looks like below.
This works fine on other devices, but causes error only with LG G2 with KitKat (Message "Unfortunately, xxxx has stopped").
It works fine with android SDK KitKat emulator and Nexus 7 with KitKat, so I belive it's not KitKat issue, but something with KitKat rom for LG G2.

This was reported by user of my app, and since I don't have actual device, I can't get stack trace, etc.
Any idea why this simple code does not work on LG G2 / KitKat?

public class samplecode extends Activity {
	AppWidgetHost appWidgetHost;

	protected void onCreate(Bundle savedInstanceState) {
		appWidgetHost = new AppWidgetHost(this, 3322);

	public void onClickAddwidget(View view){
		int appWidgetId = appWidgetHost.allocateAppWidgetId();
		Intent intent = new Intent(AppWidgetManager.ACTION_APPWIDGET_PICK);
		intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
		startActivityForResult(intent, REQUEST_CODE_ADD_APPWIDGET);