小编pcs*_*pcs的帖子

我如何使用编辑文本在自定义列表适配器中实现搜索功能

这是我的自定义列表适配器,如何使用编辑文本在自定义列表适配器中实现搜索功能。我尝试了很多方法来实现搜索功能

     public class ListAdapter extends BaseAdapter  {

   public ArrayList<Users> listDataContainers = new ArrayList<>();

        ListAdapter(ArrayList<Users> listDataContainers) {
            this.listDataContainers = listDataContainers;
        }

        @Override
        public int getCount() {

            return listDataContainers.size();
        }

        @Override
        public User getItem(int arg0) {

            return listDataContainers.get(arg0);
        }

        @Override
        public long getItemId(int arg0) {

            return arg0;
        }

        @Override
        public View getView(int pos, View arg1, ViewGroup arg2) {

            if (arg1 == null) {
                LayoutInflater inflater = (LayoutInflater) getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
                arg1 = inflater.inflate(R.layout.listitem_layout, arg2, false);
            }
            TextView pa_name = (TextView) arg1.findViewById(R.id.textName);
            TextView pa_date = …
Run Code Online (Sandbox Code Playgroud)

android

1
推荐指数
1
解决办法
1669
查看次数

如何从文件夹中删除图像

当我上传新图像时,我想从文件夹中删除以前上传的图像.

这是我上传图片的代码:

try
{
      string filename = Image1.ImageUrl.Substring(Image1.ImageUrl.IndexOf('/', Image1.ImageUrl.Length));
      if (fileupload.PostedFile.FileName.Length > 0)
      {                        
             filename = Path.GetFileName(fileupload.PostedFile.FileName);
             fileupload.SaveAs(Server.MapPath("~/Images/" + filename));
      }                    
      com.Parameters.AddWithValue("@Image",(filename.Length>0)? "Images/" + filename:string.Empty);
      com.ExecuteNonQuery();                    
}
catch (Exception ex)
{
      btnsub.Text = ex.Message;
}
Run Code Online (Sandbox Code Playgroud)

在这里,我将图像保存在一个名为Images的服务器文件夹中,使用FileUpload,所以在我上传新图像之前,我想从文件夹中删除以前上传的图像.

我可以知道,如何删除以前上传的图片?

c#

0
推荐指数
1
解决办法
2万
查看次数

id 为“GridView1”的 GridView 的数据源在 asp .net 中没有任何属性或属性

这是我的 default.aspx:

<body>
    <form id="form1" runat="server">
    <div>
 <asp:GridView ID="GridView1" runat="server">
    </asp:GridView>

    </div>

    </form>
</body>
Run Code Online (Sandbox Code Playgroud)

CS:

public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ShopifyAuthorizationState state = HttpContext.Current.Session["Shopify.AuthState"] as ShopifyAuthorizationState;
            ShopifyAPIClient client
                = new ShopifyAPIClient(state);
            string shopData = (string)client.Get("/admin/products.json");
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            // Here Product is a object class which contains all of the attribute that JSON has.
            List<Product> lstProduct = serializer.Deserialize<List<Product>>(shopData);
            GridView1.DataSource = lstProduct;
            GridView1.DataBind();
        }



        public class Product
        {

        }
    } …
Run Code Online (Sandbox Code Playgroud)

c# asp.net json gridview

0
推荐指数
1
解决办法
3031
查看次数

在Android棒棒糖中,如何检查网址是否有效?

我想要一个类似Chrome的浏览器行为,当用户输入字符串时,浏览器会决定是将字符串视为网址还是Google查询字符串.

我怎样才能做到这一点?

我在尝试,

boolean modifiedUrlValid = Patterns.WEB_URL.matcher(modifiedUrl).matches();
Run Code Online (Sandbox Code Playgroud)

但这并没有发挥作用Android 5.0.请帮忙.

问候,

validation url android

-2
推荐指数
1
解决办法
285
查看次数

标签 统计

android ×2

c# ×2

asp.net ×1

gridview ×1

json ×1

url ×1

validation ×1