Azure的易表给我包在我的ListView,而不是数据信息在Azure的表 [英] Azure easy table given me package info in my ListView instead of data in the Azure table

查看:156
本文介绍了Azure的易表给我包在我的ListView,而不是数据信息在Azure的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我查询蔚蓝表(在我的Azure表列)一个SEEDNAME我得到空回来。当我把需要的数据,如logcat中:Log.i(TAG,读取ID为对象的+ item.id ++ item.SEEDNAME);我得到正确的ID和名字空。
当我将数据添加到列表视图中我得到什么样子的包名。

When i query the azure table for a SEEDNAME (column in my Azure table) i get null back. when i put required data in the logcat like: Log.i(TAG, "Read object with ID " + item.id + " " + item.SEEDNAME); i get the proper ID and a null for the name. and when i add the data to a list view i get what looks like the package name.

public class Azuretbl {

public String id;
public String SEEDNAME;
public  String SEEDTYPE;
public int SEED_AMOUNT;

}
这是在Azure上匹配表中的客户端表。

} This is the client table which matches table on Azure.

在code进行查询:

public void viewFromAzure(){
    button_view_from_azure = (Button)findViewById(R.id.btnViewDataFromAzure);
    button_view_from_azure.setOnClickListener(
            new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    final ArrayAdapter<Azuretbl> myAdapter = new ArrayAdapter<Azuretbl>
                            (getApplicationContext(), android.R.layout.simple_list_item_activated_1);

                    azure_list_view = (ListView) findViewById(R.id.listViewAzure);

                    azure_list_view.setAdapter(myAdapter);

                    new AsyncTask<Void, Void, MobileServiceList<Azuretbl>>(){
                        MobileServiceTable<Azuretbl> myTestAzuretbl = mClient.getTable(Azuretbl.class);

                        @Override
                        protected MobileServiceList<Azuretbl> doInBackground(Void... params) {
                            MobileServiceList<Azuretbl> result;
                            try {
                                result = myTestAzuretbl.where().field("SEEDNAME").eq("Tomato").execute().get();

                                /*where().field("SEEDNAME").eq("tomato").*/
                                final MobileServiceList<Azuretbl> finalResult = result;
                                runOnUiThread(new Runnable() {
                                    @Override
                                    public void run() {

                                    myAdapter.clear();

                                        for (Azuretbl item : finalResult) {

                                            Log.i(TAG, "Read object with ID " + item.id + " " + item.SEEDNAME);

                                            System.out.println("Item is " + finalResult);
                                            myAdapter.add(item);
                                        }
                                    }
                                });

                            } catch (Exception exception) {

                            }
                            return null;
                        }
                    }.execute();


                }
            }
    );
}

和我得到这个在logcat的:

and i get this in the logcat:

04-09 13:21:29.232 3029-3029/? I/JonnysMessage: Read object with ID a822b906-5f84-4345-86d2-3031247e380a null

04-09 13:21:29.232 3029-3029/? I/System.out: Item is [com.jonnyg.gardenapp.Azuretbl@537e457c, com.jonnyg.gardenapp.Azuretbl@537e4b04]

在应用程序列表视图的快照
在应用列表视图的结果

Snapshot of listview on app Result of the listview on app

这是云的Azure表的快照
Azure的快照

snapshot of Azure table on cloud Azure snapshot of table

我想补充我使用Azure上的新门户。我有权限设置读取插入等。允许匿名访问。我不使用的应用程序键做我需要吗?

just to add i am using the new portal on azure. i have permission set for read insert etc.. to allow anonymous access. I am not using an application key do i need one?

推荐答案

我已经找到了我的问题。
在Azure上我创造了方便的表已经在该地区的实地SEEDNAME为seedNAME在其中添加一列在Azure上查看表时,这是可见和不可见。解决这个种子的名称后,查看在logcat中。

I have figured out my problem. On azure the easy table i had created had the field SEEDNAME as seedNAME in the area where you add a column this was visible and not visible when viewing the table on azure. After solving this the Seed name was viewing in the logcat.

我还创建一个自定义的适配器列表视图来查看数据。

I also created a custom adapter to view the data in a listview.

这篇关于Azure的易表给我包在我的ListView,而不是数据信息在Azure的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆