public void onResume() { super.onResume(); mainapp = (SSCXferApp) getApplication(); Log.d(TAG, " onResume "); setContentView(R.layout.library_layout); makeCursorAndAdapter(); registerForContextMenu(getListView()); if (importPreference) { ImporterThread importer = new ImporterThread(); importer.run(); } }
@Override public boolean onOptionsItemSelected(MenuItem menuitem) { int menuNum = menuitem.getItemId(); Log.d("MENU", "Option " + menuNum + " selected"); switch (menuitem.getItemId()) { // Importing case MENU_ITEM_10: ImporterThread importer = new ImporterThread(); importer.run(); break; case MENU_ITEM_5: // ABOUT String mesg = getString(R.string.about_this); // find&replace VERSION mesg = mesg.replace("VERSION", "version " + getVersionName()); final SpannableString s = new SpannableString(mesg); Linkify.addLinks(s, Linkify.ALL); // Licenses String mesg2 = getString(R.string.third_party_licenses); final SpannableString s2 = new SpannableString(mesg2); Linkify.addLinks(s2, Linkify.ALL); AlertDialog about = new AlertDialog.Builder(this) .setMessage(s) .setPositiveButton( R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) {} }) .setNegativeButton( R.string.licenses, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { AlertDialog licenses = new AlertDialog.Builder(LibraryActivity.this) .setMessage(s2) .setPositiveButton( R.string.yes, new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialog, int whichButton) {} }) .show(); // makes links work ((TextView) licenses.findViewById(android.R.id.message)) .setMovementMethod(LinkMovementMethod.getInstance()); } }) .show(); // makes links work ((TextView) about.findViewById(android.R.id.message)) .setMovementMethod(LinkMovementMethod.getInstance()); break; case MENU_ITEM_6: // Preferences Intent intent = new Intent().setClass(this, PreferencesActivity.class); this.startActivityForResult(intent, 0); break; } return true; }