Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>now I perform an action in the detail that needs to finish it</p> </blockquote> <p>That is unusual flow for the master/detail pattern. Normally, the detail persists until the user taps on something else in the master list. I could see your proposed flow for a delete operation on the item being viewed, though.</p> <blockquote> <p>I was thinking about a callback that both activities would implement and the single pane would just finish it self and therefore finishing the fragment, and the dual pane would just pop the fragment.</p> </blockquote> <p>That is a fine answer.</p> <blockquote> <p>Isnt this much overhead?</p> </blockquote> <p>No. Define an interface that all activities hosting your fragment must implement. You might consider using the contract pattern to help enforce that:</p> <pre><code>import android.app.Activity; import com.actionbarsherlock.app.SherlockFragment; // from https://gist.github.com/2621173 public abstract class ContractFragment&lt;T&gt; extends SherlockFragment { private T mContract; @SuppressWarnings("unchecked") @Override public void onAttach(Activity activity) { try { mContract=(T)activity; } catch (ClassCastException e) { throw new IllegalStateException(activity.getClass() .getSimpleName() + " does not implement " + getClass().getSimpleName() + "'s contract interface.", e); } super.onAttach(activity); } @Override public void onDetach() { super.onDetach(); mContract=null; } public final T getContract() { return mContract; } } </code></pre> <p>(code based on <a href="https://gist.github.com/2621173" rel="nofollow">a gist from Jake Wharton</a> of ActionBarSherlock fame)</p> <p>Here, <code>T</code> is the name of the interface. Your fragment would inherit from this and call <code>getContract()</code> to retrieve the interface implementation object, on which you call your callback method. Runtime overhead will be on the order of a few dozen instructions at most -- nothing you will need to worry about.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload