I will try to be as explanatory as possible, I am developing an Android app, in a Java class I have List with some data (objects), I want to transfer this list to another Java class (Activity), in order to use this list's data within this class.
here is my code:
public class DocumentariesCategoriesActivity extends Activity implements AdapterView.OnItemClickListener{
private List<VideoEntity> videoSearchResult;
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Log.d(TAG, "onItemClick(AdapterView<?> , View, int, long) - Ini");
new Thread(new Runnable() {
@Override
public void run (){
YouTubeConnector youtube = new YouTubeConnector(DocumentariesCategoriesActivity.this);
videoSearchResult = youtube.search();
handler.post(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(DocumentariesCategoriesActivity.this, DocumentariesCatalogActivity.class).putExtra("videos", (Parcelable) videoSearchResult);
startActivity(intent);
}
});
}
}).start();
}
As you can see in the code the activity I want to transfer the list to is DocumentariesCatalogActivity
. I don't know if this is the correct way to pass it, if it is then my question will be how can I capture the VideoEntity
List in the DocumentariesCatalogActivity
class ?
I saw some similar questions but only with String type.