コード例 #1
0
  @Override
  protected void onStop() {
    getContentResolver().unregisterContentObserver(observer);
    cursor.close();

    super.onStop();
  }
コード例 #2
0
  @Override
  protected void onRestart() {
    super.onRestart();

    sendStickyBroadcast(new Intent("com.announcify.ACTION_PLUGIN_CONTACT"));
    refreshList();
  }
コード例 #3
0
  @Override
  protected void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState, R.layout.main_list);

    getListView().setFastScrollEnabled(true);

    sendStickyBroadcast(new Intent("com.announcify.ACTION_PLUGIN_CONTACT"));

    registerForContextMenu(getListView());

    getListView()
        .setOnItemClickListener(
            new OnItemClickListener() {

              public void onItemClick(
                  final AdapterView<?> arg0, final View arg1, final int arg2, final long arg3) {
                try {
                  startActivity(new Intent(model.getAction(arg3)));
                } catch (final Exception e) {
                  model.remove(arg3);

                  Toast.makeText(
                          AnnouncifyActivity.this,
                          getString(R.string.toast_plugin_not_found),
                          Toast.LENGTH_LONG)
                      .show();
                }
              }
            });

    model = new PluginModel(this);

    refreshList();
    getListView().setSelection(firstVisible);
  }
コード例 #4
0
  @Override
  protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode > 2000) {
      try {
        getPackageManager().getPackageGids(model.getPackage(requestCode - 2000));
      } catch (final NameNotFoundException e) {
        model.remove(requestCode - 2000);
      }
    }
  }
コード例 #5
0
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   outState.putInt(KEY_LIST_POSITION, firstVisible);
 }