开发者

How to retrieve particular data on clicking record from arraylist (Sqlite database)in Android??

i have show records in array-list on one layout.now i want to show like....if i click on particular record then that particular record must show 开发者_开发百科on layout..i.e on next or another layout fully.i used Sqlite database.

lvUsers.setClickable(true);


    lvUsers.setOnItemClickListener(new AdapterView.OnItemClickListener() 
    {

          public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) 
          {

            Object o = lvUsers.getItemAtPosition(position);
            UserBO obj = (UserBO) o;
            Toast.makeText(Select.this, "Record Selected= "+obj.getId()+" "+obj.getName()+" "+obj.getAge()+" "+obj.getDate()+" "+obj.getTime(), Toast.LENGTH_LONG).show();              

            Intent i = new Intent(Select.this,ShowProfile.class);
                startActivity(i);   

         }


        });

Thanks in Advance----


setOnItemClickListener to the ListView as follows

lvUsers.setOnItemClickListener(this);

implement the interface

OnItemClickListener

and then add the following override method

@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) {

}

In the above method the parameter position indicates the the position of the item has been clicked in ListView

By using this you can get the clicked item and pass it to the next Activity.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜