我必须在功能开始之前提供之前的所有链接,如果我点击其中的项目ListView
,它必须转到那个视频链接,现在我给出了持有人中的链接ListView
,如果我点击第一个项目,它看起来不太好在ListView
,它将采用我需要的相应方式的第一个链接。
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main1);
ArrayList<Recipedetails1> image_details = GetSearchResults();
final ListView lv1 = (ListView) findViewById(R.id.listV1_main);
lv1.setAdapter(new ItemListBaseAdapter1(this, image_details));
lv1.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> a, View v, int position, long id) {
Object o = lv1.getItemAtPosition(position);
Recipedetails1 obj_itemDetails = (Recipedetails1)o;
final Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(((Recipedetails1) o).getUrlWiki()));
startActivity(i);
}
});
}
private ArrayList<Recipedetails1> GetSearchResults(){
ArrayList<Recipedetails1> results = new ArrayList<Recipedetails1>();
Recipedetails1 item_details = new Recipedetails1();
item_details.setName1("Vegterian");
item_details.setItemDescription1("Recipes made by raw materials");
item_details.setUrlWiki("https://www.youtube.com/watch?v=C_r0mFvMSfU");
item_details.setImageNumber1(1);
results.add(item_details);
item_details = new Recipedetails1();
item_details.setName1("Non-Vegterian");
item_details.setItemDescription1("Flesh of sweet animals");
item_details.setUrlWiki("https://www.youtube.com/watch?v=C_r0mFvMSfU");
item_details.setImageNumber1(2);
results.add(item_details);
item_details = new Recipedetails1();
item_details.setName1("Pickels");
item_details.setItemDescription1("Touchable dish by Homemade");
item_details.setUrlWiki("https://www.youtube.com/watch?v=C_r0mFvMSfU");
item_details.setImageNumber1(3);
results.add(item_details);
item_details = new Recipedetails1();
item_details.setName1("Soups");
item_details.setItemDescription1("Startup for our food");
item_details.setUrlWiki("https://www.youtube.com/watch?v=C_r0mFvMSfU");
item_details.setImageNumber1(4);
results.add(item_details);
return results;
}
实际上我不需要这种方式,因为它看起来不太好,我希望我的链接不显示,它必须在单击 ListView 中的项目后工作,实际上在我的代码中,单击项目后它会去,但是它将从我的持有人链接中获取这是提供链接的任何其他方式。这种代码方法看起来不太好,我不需要我的持有人也想显示我的链接