Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Actionbar Sherlock OnListItemClick bug?
    primarykey
    data
    text
    <p>Hey guys so I'm having a bit of trouble with the OnListItemClick from a SherlockListFragment. When I create my DetailFrag and instantiate it with the DetailFrag class it works fine on first item click, but the very next item click my frag returns null and takes me to a separate activity. What's weird is that if I don't include the Actionbar Sherlock library it works fine. I also made sure I used SherlockFragmentActivity and SherlockFragment for the activities and other fragment class. Thanks for the help.</p> <pre><code>public class ListFrag extends SherlockListFragment { private ListView lv; private List&lt;ParseObject&gt; artQuery; private ProgressDialog dialog; private LayoutInflater mInflater; private Dialog progressDialog; private boolean taskRun; private Context context; private CustomAdapter adapter; private List&lt;ParseObject&gt; objects; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.list, container, false); Log.i("NavigationListFragment", "ListView Inflated!!"); return view; } @Override public void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); ParseObject parseObject = (ParseObject) getListView().getItemAtPosition(position); DetailFrag frag = (DetailFrag) getFragmentManager().findFragmentById(R.id.frag_art); Artist a = new Artist(parseObject); ArrayList&lt;String&gt; data = new ArrayList&lt;String&gt;(); Toast.makeText(getActivity(), "ArtName is" + parseObject.getString("artistName"), Toast.LENGTH_LONG).show(); //Toast.makeText(getActivity(), "ArtName is" + a.artName, Toast.LENGTH_LONG).show(); data.add(a.getArtName()); data.add(a.getCountry()); data.add(a.getObjectId()); data.add(a.getDeath()); data.add(a.getInfo()); String artistPhoto = parseObject.getParseFile("photo").getUrl(); if (frag == null || !frag.isInLayout()) { Intent intent = new Intent(); intent.setClass(getActivity(), DetailActivity.class); intent.putExtra("artistPhoto", artistPhoto); intent.putStringArrayListExtra("data", data); startActivity(intent); } else { FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.frag_art, frag); ft.commit(); frag.getData(data, artistPhoto); } } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); new RemoteDataTask().execute(); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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. This table or related slice is empty.
    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