auto import from //branches/cupcake/...@132276

This commit is contained in:
The Android Open Source Project
2009-02-19 10:57:36 -08:00
parent b9f5851434
commit 4772968987
64 changed files with 1990 additions and 2455 deletions

View File

@@ -59,8 +59,19 @@ public class GadgetPickActivity extends LauncherActivity
public void onListItemClick(ListView l, View v, int position, long id)
{
Intent intent = intentForPosition(position);
mGadgetManager.bindGadgetId(mGadgetId, intent.getComponent());
setResultData(RESULT_OK);
int result;
try {
mGadgetManager.bindGadgetId(mGadgetId, intent.getComponent());
result = RESULT_OK;
} catch (IllegalArgumentException e) {
// This is thrown if they're already bound, or otherwise somehow
// bogus. Set the result to canceled, and exit. The app *should*
// clean up at this point. We could pass the error along, but
// it's not clear that that's useful -- the gadget will simply not
// appear.
result = RESULT_CANCELED;
}
setResultData(result);
finish();
}