My Code:
userListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String userURL = "https://api.github.com/users/" + userNameList.get(position) + "?" + accessToken;
new JSONTask().execute(userURL);
Intent intent = new Intent(getActivity(), ProfileActivity.class);
String key = userNameList.get(position);
intent.putExtra("userName", key);
startActivity(intent);
}
});
This part of my code is a click listener of each item in my list view which is a profile of github users. So, whenever I click an item, it moves to another activity which parses the info from the DB which were stored through
new JSONTask().execute(userURL);
The JSONTask (asyncTask). Moving to the next activity works fine, but when I press the back button, it suddenly stops my app.
It doesn't give me an error when I comment out the JSONTask, but then it won't store the info of the user to the DB.
What could be the problem in this case?