结果前后滴答

时间:2016-03-10 17:29:50

标签: sql comma

我希望我的查询结果在结果之前和之后都有刻度,以及之间的逗号:

Disallow

无论如何这可能吗?

1 个答案:

答案 0 :(得分:1)

 public class Nraeby_ListViewAdapter extends BaseAdapter {
    private String Liked;
    Context mContext;
    // Declare Variables
    LayoutInflater inflater;
    private ArrayList<HashMap<String, String>> data;
    ImageLoader imageLoader;
    HashMap<String, String> resultp = new HashMap<String, String>();

    public Nraeby_ListViewAdapter(Context context,
                                  ArrayList<HashMap<String, String>> arraylist) {
        this.data = arraylist;
        mContext = context;

        imageLoader = new ImageLoader(mContext);
        inflater = LayoutInflater.from(mContext);

    }


    @Override
    public int getCount() {
        return data.size();
    }

    @Override
    public Object getItem(int position) {
        return data.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }


    public class ViewHolder {
        // Declare Variables
        TextView rank;
        TextView country;
        TextView population;
        test.Droidlogin.CircleImage flag;
        test.Droidlogin.material.AnimateCheckBox checkBox;
        ImageButton btnFavourite;


    }
    public View getView(final int position, View view, ViewGroup parent) {

        final ViewHolder holder;
        if (view == null) {
            holder = new ViewHolder();
            view = inflater.inflate(R.layout.nearby_listview_item, null);

            // Get the position
            resultp = data.get(position);
            // Locate the TextViews in nearby_listview_item.xmltem.xml

            holder.rank = (TextView) view.findViewById(R.id.rank);
            holder.country = (TextView) view.findViewById(R.id.country);
            // Locate the ImageView in nearby_listview_item.xmltem.xml
            holder.flag = (test.Droidlogin.CircleImage) view.findViewById(R.id.flag);
            holder.checkBox = (test.Droidlogin.material.AnimateCheckBox) view.findViewById(R.id.checkbox);
            holder.btnFavourite = (ImageButton) view.findViewById(R.id.like);
            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        // Capture position and set results to the TextViews
        holder.rank.setText(resultp.get(NearbyUsers.RANK));
        holder.country.setText(resultp.get(NearbyUsers.COUNTRY));
        // Capture position and set results to the ImageView
        // Passes flag images URL into ImageLoader.class
        imageLoader.DisplayImage(resultp.get(NearbyUsers.FLAG), holder.flag);

        TinyDB tinydb = new TinyDB(mContext);
        Liked = tinydb.getString("MyUsers");




        //This handle and change icon when click on.
        holder.btnFavourite.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                TinyDB tinydb = new TinyDB(mContext);

                holder.btnFavourite.setImageResource(R.drawable.icon_liked);
                tinydb.putString("MyUsers",resultp.get(NearbyUsers.COUNTRY));


                holder.btnFavourite.setImageResource(R.drawable.icon_liked);

            }
        });


        // Capture ListView item click
        view.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View arg0) {
                // Get the position
                Intent intent = new Intent(mContext, SingleItemViewNearbyProfile.class);
                // Pass all data rank
                intent.putExtra("rank", resultp.get(NearbyUsers.RANK));
                // Pass all data country
                intent.putExtra("country", resultp.get(NearbyUsers.COUNTRY));
                // Pass all data population
                intent.putExtra("population",resultp.get(NearbyUsers.POPULATION));
                // Pass all data flag
                intent.putExtra("flag", resultp.get(NearbyUsers.FLAG));
                // Start SingleItemView Class
                mContext.startActivity(intent);

            }
        });
        return view;


    }



}

您需要修剪转换后的值以移除间距,并使用(+)符号连接值。