.setTabListener(new TabListener<FragmentStack.CountingFragment>( this, "simple", FragmentStack.CountingFragment.class))); bar.addTab(bar.newTab() .setText("Contacts") .setTabListener(new TabListener<LoaderCursor.CursorLoaderListFragment>( this, "contacts", LoaderCursor.CursorLoaderListFragment.class))); bar.addTab(bar.newTab() .setText("Apps") .setTabListener(new TabListener<LoaderCustom.AppListFragment>( this, "apps", LoaderCustom.AppListFragment.class))); bar.addTab(bar.newTab() .setText("Throttle") .setTabListener(new TabListener<LoaderThrottle.ThrottledLoaderListFragment>( this, "throttle", LoaderThrottle.ThrottledLoaderListFragment.class)));
new UiFragment()).commit(); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { mWorkFragment.restart(); mWorkFragment = new RetainedFragment();
@Override public Loader<List<AppEntry>> onCreateLoader(int id, Bundle args) { // This is called when a new Loader needs to be created. This // sample only has one Loader with no arguments, so it is simple. return new AppListLoader(getActivity()); }
@Override public void onLoadFinished(Loader<List<AppEntry>> loader, List<AppEntry> data) { // Set the new data in the adapter. mAdapter.setData(data); // The list should now be shown. if (isResumed()) { setListShown(true); } else { setListShownNoAnimation(true); } }
public void onClick(View v) { if (mCurConnection != null) { unbindService(mCurConnection); mCurConnection = null; } ServiceConnection conn = new MyServiceConnection(); if (bindService(mBindIntent, conn, Context.BIND_AUTO_CREATE)) { mCurConnection = conn; } } };
/** * Perform provider creation. */ @Override public boolean onCreate() { mOpenHelper = new DatabaseHelper(getContext()); // Assumes that any failures will be reported by a thrown exception. return true; }
public void onClick(View v) { // When button is clicked, call up to owning activity. ((FragmentDialog)getActivity()).showDialog(); } });
/** * The main job of the constructor is to call {@link #setupSuggestions(String, int)} with the * appropriate configuration values. */ public SearchSuggestionSampleProvider() { super(); setupSuggestions(AUTHORITY, MODE); } }
@Override public void run() { showToast("Error code:" + getResultCode()); } });
@Override public int onStartCommand(Intent intent, int flags, int startId) { handleCommand(intent); // We want this service to continue running until it is explicitly // stopped, so return sticky. return START_STICKY; }
/** * Simple helper for summaries showing local & global (aggregate) policy settings */ protected String localGlobalSummary(Object local, Object global) { return getString(R.string.status_local_global, local, global); } }
@Override public void onLoadFinished(Loader<List<AppEntry>> loader, List<AppEntry> data) { // Set the new data in the adapter. mAdapter.setData(data); // The list should now be shown. if (isResumed()) { setListShown(true); } else { setListShownNoAnimation(true); } }
public void onClick(View v) { if (mCurConnection != null) { unbindService(mCurConnection); mCurConnection = null; } ServiceConnection conn = new MyServiceConnection(); if (bindService(mBindIntent, conn, Context.BIND_AUTO_CREATE | Context.BIND_ALLOW_OOM_MANAGEMENT)) { mCurConnection = conn; } } };
@Override public Loader<List<AppEntry>> onCreateLoader(int id, Bundle args) { // This is called when a new Loader needs to be created. This // sample only has one Loader with no arguments, so it is simple. return new AppListLoader(getActivity()); }
/** * Perform provider creation. */ @Override public boolean onCreate() { mOpenHelper = new DatabaseHelper(getContext()); // Assumes that any failures will be reported by a thrown exception. return true; }
public void onClick(View v) { // When button is clicked, call up to owning activity. ((FragmentDialog)getActivity()).showDialog(); } });
public void onClick(View v) { if (mCurConnection != null) { unbindService(mCurConnection); mCurConnection = null; } ServiceConnection conn = new MyServiceConnection(); if (bindService(mBindIntent, conn, Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT)) { mCurConnection = conn; } } };
public void onClick(View v) { if (mCurConnection != null) { unbindService(mCurConnection); mCurConnection = null; } ServiceConnection conn = new MyServiceConnection(true); if (bindService(mBindIntent, conn, Context.BIND_AUTO_CREATE | Context.BIND_WAIVE_PRIORITY)) { mCurConnection = conn; } } };
public void onClick(View v) { if (mCurConnection != null) { unbindService(mCurConnection); mCurConnection = null; } ServiceConnection conn = new MyServiceConnection(); if (bindService(mBindIntent, conn, Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND)) { mCurConnection = conn; } } };
public void onClick(View v) { if (mCurConnection != null) { unbindService(mCurConnection); mCurConnection = null; } ServiceConnection conn = new MyServiceConnection(); if (bindService(mBindIntent, conn, Context.BIND_AUTO_CREATE | Context.BIND_ADJUST_WITH_ACTIVITY | Context.BIND_WAIVE_PRIORITY)) { mCurConnection = conn; } } };