List of usage examples for android.app Activity toString
@Override
public String toString()
From source file:com.citrus.sample.WalletPaymentFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {/* w w w. ja v a2 s . c o m*/ mListener = (WalletFragmentListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement WalletFragmentListener"); } }
From source file:fiskinfoo.no.sintef.fiskinfoo.MyToolsFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {//from w w w .ja v a 2s . co m mListener = (OnFragmentInteractionListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnFragmentInteractionListener"); } }
From source file:com.owncloud.android.ui.dialog.WebViewDialog.java
@Override public void onAttach(Activity activity) { Log_OC.v(TAG, "onAttach"); super.onAttach(activity); try {//from w w w . ja v a 2 s.c o m AuthenticationMethod authenticationMethod = AuthenticationMethod .fromValue(getArguments().getInt(ARG_AUTHENTICATION_METHOD)); if (authenticationMethod == null) { throw new IllegalStateException("Null authentication method got to onAttach"); } Handler handler = new Handler(); switch (authenticationMethod) { case BEARER_TOKEN: mOAuthWebViewClientListener = (OAuthWebViewClientListener) activity; mWebViewClient = new OAuthWebViewClient(activity, handler, mOAuthWebViewClientListener); break; case SAML_WEB_SSO: mSsoWebViewClientListener = (SsoWebViewClientListener) activity; mWebViewClient = new SAMLWebViewClient(activity, handler, mSsoWebViewClientListener); break; default: throw new IllegalStateException("Invalid authentication method got to onAttach"); } } catch (ClassCastException e) { throw new ClassCastException( activity.toString() + " must implement " + SsoWebViewClientListener.class.getSimpleName() + " and " + OAuthWebViewClientListener.class.getSimpleName()); } }
From source file:android.com.example.contactslist.ui.ContactsListFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {/*w w w . j a v a 2 s .c o m*/ // Assign callback listener which the holding activity must implement. This is used // so that when a contact item is interacted with (selected by the user) the holding // activity will be notified and can take further action such as populating the contact // detail pane (if in multi-pane layout) or starting a new activity with the contact // details (single pane layout). mOnContactSelectedListener = (OnContactsInteractionListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnContactsInteractionListener"); } }
From source file:im.vector.VectorApp.java
@Override public void onCreate() { Log.d(LOG_TAG, "onCreate"); super.onCreate(); if (BuildConfig.DEBUG) { Stetho.initializeWithDefaults(this); }//from w w w . ja va 2s . c o m instance = this; mCallsManager = new CallsManager(this); mActivityTransitionTimer = null; mActivityTransitionTimerTask = null; try { PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0); VERSION_BUILD = packageInfo.versionCode; } catch (PackageManager.NameNotFoundException e) { Log.e(LOG_TAG, "fails to retrieve the package info " + e.getMessage()); } VECTOR_VERSION_STRING = Matrix.getInstance(this).getVersion(true, true); // not the first launch if (null != Matrix.getInstance(this).getDefaultSession()) { SDK_VERSION_STRING = Matrix.getInstance(this).getDefaultSession().getVersion(true); } else { SDK_VERSION_STRING = ""; } try { PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0); SHORT_VERSION = pInfo.versionName; } catch (Exception e) { } mLogsDirectoryFile = new File(getCacheDir().getAbsolutePath() + "/logs"); org.matrix.androidsdk.util.Log.setLogDirectory(mLogsDirectoryFile); org.matrix.androidsdk.util.Log.init("RiotLog"); // log the application version to trace update // useful to track backward compatibility issues Log.d(LOG_TAG, "----------------------------------------------------------------"); Log.d(LOG_TAG, "----------------------------------------------------------------"); Log.d(LOG_TAG, " Application version: " + VECTOR_VERSION_STRING); Log.d(LOG_TAG, " SDK version: " + SDK_VERSION_STRING); Log.d(LOG_TAG, " Local time: " + (new SimpleDateFormat("MM-dd HH:mm:ss.SSSZ", Locale.US)).format(new Date())); Log.d(LOG_TAG, "----------------------------------------------------------------"); Log.d(LOG_TAG, "----------------------------------------------------------------\n\n\n\n"); mRageShake = new RageShake(this); // init the REST client MXSession.initUserAgent(getApplicationContext()); this.registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() { final Map<String, String> mLocalesByActivity = new HashMap<>(); @Override public void onActivityCreated(Activity activity, Bundle savedInstanceState) { Log.d(LOG_TAG, "onActivityCreated " + activity); mCreatedActivities.add(activity.toString()); ThemeUtils.setActivityTheme(activity); // piwik onNewScreen(activity); } @Override public void onActivityStarted(Activity activity) { Log.d(LOG_TAG, "onActivityStarted " + activity); } /** * Compute the locale status value * @param activity the activity * @return the local status value */ private String getActivityLocaleStatus(Activity activity) { return getApplicationLocale().toString() + "_" + getFontScale() + "_" + ThemeUtils.getApplicationTheme(activity); } @Override public void onActivityResumed(final Activity activity) { Log.d(LOG_TAG, "onActivityResumed " + activity); setCurrentActivity(activity); String activityKey = activity.toString(); if (mLocalesByActivity.containsKey(activityKey)) { String prevActivityLocale = mLocalesByActivity.get(activityKey); if (!TextUtils.equals(prevActivityLocale, getActivityLocaleStatus(activity))) { Log.d(LOG_TAG, "## onActivityResumed() : restart the activity " + activity + " because of the locale update from " + prevActivityLocale + " to " + getActivityLocaleStatus(activity)); restartActivity(activity); return; } } // it should never happen as there is a broadcast receiver (mLanguageReceiver) if (!TextUtils.equals(Locale.getDefault().toString(), getApplicationLocale().toString())) { Log.d(LOG_TAG, "## onActivityResumed() : the locale has been updated to " + Locale.getDefault().toString() + ", restore the expected value " + getApplicationLocale().toString()); updateApplicationSettings(getApplicationLocale(), getFontScale(), ThemeUtils.getApplicationTheme(activity)); restartActivity(activity); } listPermissionStatuses(); } @Override public void onActivityPaused(Activity activity) { Log.d(LOG_TAG, "onActivityPaused " + activity); mLocalesByActivity.put(activity.toString(), getActivityLocaleStatus(activity)); setCurrentActivity(null); onAppPause(); } @Override public void onActivityStopped(Activity activity) { Log.d(LOG_TAG, "onActivityStopped " + activity); } @Override public void onActivitySaveInstanceState(Activity activity, Bundle outState) { Log.d(LOG_TAG, "onActivitySaveInstanceState " + activity); } @Override public void onActivityDestroyed(Activity activity) { Log.d(LOG_TAG, "onActivityDestroyed " + activity); mCreatedActivities.remove(activity.toString()); mLocalesByActivity.remove(activity.toString()); if (mCreatedActivities.size() > 1) { Log.d(LOG_TAG, "onActivityDestroyed : \n" + mCreatedActivities); } } }); // create the markdown parser try { mMarkdownParser = new VectorMarkdownParser(this); } catch (Exception e) { // reported by GA Log.e(LOG_TAG, "cannot create the mMarkdownParser " + e.getMessage()); } // track external language updates // local update from the settings // or screen rotation ! VectorApp.getInstance().registerReceiver(mLanguageReceiver, new IntentFilter(Intent.ACTION_LOCALE_CHANGED)); VectorApp.getInstance().registerReceiver(mLanguageReceiver, new IntentFilter(Intent.ACTION_CONFIGURATION_CHANGED)); PreferencesManager.fixMigrationIssues(this); initApplicationLocale(); }
From source file:net.ddns.mlsoftlaberge.trycorder.TryviscamFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {/*from w w w . java 2s . c o m*/ // Assign callback listener which the holding activity must implement. mOnTryviscamInteractionListener = (TryviscamFragment.OnTryviscamInteractionListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnTryviscamInteractionListener"); } }
From source file:com.example.android.contactslist.ui.groupsEditor.GroupsEditorFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {/*from ww w.jav a2 s. co m*/ // Assign callback listener which the holding activity must implement. This is used // so that when a contact item is interacted with (selected by the user) the holding // activity will be notified and can take further action such as populating the contact // detail pane (if in multi-pane layout) or starting a new activity with the contact // details (single pane layout). mOnGroupSelectedListener = (OnGroupsInteractionListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnGroupsInteractionListener"); } }
From source file:br.com.mybaby.contatos.ContactsListFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); try {//www. ja va2 s. co m // Assign callback listener which the holding activity must implement. This is used // so that when a contact item is interacted with (selected by the user) the holding // activity will be notified and can take further action such as populating the contact // detail pane (if in multi-pane layout) or starting a new activity with the contact // details (single pane layout). mOnContactSelectedListener = (OnContactsInteractionListener) activity; activity.getIntent().putExtra(extraSMSTel, extraSMSTel); } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnContactsInteractionListener"); } }
From source file:edu.umbc.cs.ebiquity.mithril.parserapp.contentparsers.contacts.ContactsListFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity.getApplicationContext()); try {/*from ww w. ja v a 2 s .c o m*/ // Assign callback listener which the holding activity must implement. This is used // so that when a contact item is interacted with (selected by the user) the holding // activity will be notified and can take further action such as populating the contact // detail pane (if in multi-pane layout) or starting a new activity with the contact // details (single pane layout). mOnContactSelectedListener = (OnContactsInteractionListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnContactsInteractionListener"); } }
From source file:com.todoroo.astrid.activity.TaskListFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); // Check that the container activity has implemented the callback // interface//www.j a v a 2 s . c om try { mListener = (OnTaskListItemClickedListener) activity; } catch (ClassCastException e) { throw new ClassCastException(activity.toString() + " must implement OnTaskListItemClickedListener"); //$NON-NLS-1$ } }