开发者

on listview click show different-2 activity

开发者 https://www.devze.com 2023-02-23 06:09 出处:网络
dear... sir/mam, in my application every list item position has different responce id ..i want to disply toast message of that responce id according to position clicked on it means bundle that respons

dear... sir/mam, in my application every list item position has different responce id ..i want to disply toast message of that responce id according to position clicked on it means bundle that response id according to position what to do ...sir i am new in android so describe it with code ..i attach my some code so pls add neccesery code on it...pls pls thanks in advance

 @Override
    开发者_如何学编程**protected void onListItemClick(ListView l, View v, int position, long id)
    {
        super.onListItemClick(l, v, position, id);
        **String responceid = Activity2.getData();**

        Object o = (String) (Notepadv3.this).getListAdapter().getItem(position);**

        Toast.makeText(this, "this row  responce id is= " + " " + , Toast.LENGTH_LONG).show();



}


Have your response in a ArrayList of type String.

ArrayList respCode<String> =new Arraylist<String>();
respCode.add("RESPONSE 1");
respCode.add("RESPONSE 2");

then in the listview itemClickListner

@Override
   public void onItemClick(AdapterView<?> a, View v, int position, long id) {

    Toast.makeText(this,respCode.get(position), Toast.LENGTH_LONG).show();
     }


try Toast.makeText(this, "this row responce id is= " + responceid + , Toast.LENGTH_LONG).show();

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号