ANDROID:电子邮件客户端接收者电子邮件 ID 在 android-parse 中为空 [英] ANDROID: email client receiver email id empty in android-parse

查看:24
本文介绍了ANDROID:电子邮件客户端接收者电子邮件 ID 在 android-parse 中为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用程序中使用 android-parse 服务器.下面是电子邮件列的解析数据库屏幕截图.电子邮件列在数据库中隐藏的密码列之后.

我的问题是

<小时>

当我将电子邮件 ID 检索到电子邮件客户端时,即使 email 列有 email , email 也是空的.

<小时>

注意:在另一个地方(另一个表)的应用程序中,我以相同的方式将电子邮件 ID 提取到电子邮件客户端,但邮件显示良好.. 仅在此处出现问题.

如果有人知道请帮忙吗?

<块引用>

这是解析数据库中的电子邮件列

 尝试{JSONObject jsonObject = parseObjectToJson(object);Log.d("对象", jsonObject.toString());Log.d("Email", "+" + object.get("email"));personNumber = jsonObject.getString("电话");personEmail = jsonObject.getString("email");}catch (JSONException je){}catch (ParseException pe){}

<块引用>

这是电子邮件按钮

 emailPerson = (Button)findViewById(R.id.individualEmail);emailPerson.setOnClickListener(new View.OnClickListener() {@覆盖public void onClick(View v) {Intent i = new Intent(Intent.ACTION_SEND);i.setData(Uri.parse("mailto:"));i.setType("纯文本/文本");i.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {personEmail});开始活动(i);}});if(personEmail==null || personEmail.equals("") || personEmail.equals(" ")){emailPerson.setClickable(false);emailPerson.setEnabled(false);emailPerson.setVisibility(View.GONE);}别的{emailPerson.setEnabled(true);emailPerson.setClickable(true);emailPerson.setVisibility(View.VISIBLE);}

<小时><块引用>

这里工作正常,但这是同一数据库中的不同表.>在这个表中没有隐藏的密码字段

尝试{企业邮箱 = jsonObject.getString("email");if(corporateEmail == null ||corporateEmail.equals("")){emailCorporate.setVisibility(View.GONE);emailCorporate.setEnabled(false);emailCorporate.setClickable(false);}

<小时>

emailCorporate = (Button) findViewById(R.id.corporateEmail);emailCorporate.setOnClickListener(new View.OnClickListener() {@覆盖public void onClick(View v) {Intent i = new Intent(Intent.ACTION_SEND);i.setData(Uri.parse("mailto:"));i.setType("纯文本/文本");i.putExtra(Intent.EXTRA_EMAIL, new String[] {corporateEmail});开始活动(i);}});

<小时>

 私有 JSONObject parseObjectToJson(ParseObject parseObject) 抛出 ParseException, JSONException, com.parse.ParseException {JSONObject jsonObject = new JSONObject();parseObject.fetchIfNeeded();设置<字符串>键 = parseObject.keySet();对于(字符串键:键){Object objectValue = parseObject.get(key);if (objectValue instanceof ParseObject) {jsonObject.put(key, parseObjectToJson(parseObject.getParseObject(key)));} else if (objectValue instanceof ParseRelation) {} 别的 {jsonObject.put(key, objectValue.toString());}}返回 json 对象;}

解决方案

如果 jsonObject 不是 null,请检查您正在从中提取数据的解析数据库是否具有email"标签

I'm using android- parse server in app. below is parse db screenshot of email column . the email column is after the hidden password column in database .

my problem is


when i retrieve email ids to email client, email is null even if the email column has emails .


note : in the app in another place (another table) i'm pulling email ids to email client in same manner, but there mail is showing well .. only here the problem occurs.

if anyone knows please help ?

this is email column in parse database

 try{
                        JSONObject jsonObject = parseObjectToJson(object);
                        Log.d("Object", jsonObject.toString());
                        Log.d("Email", "+" + object.get("email"));
                        personNumber = jsonObject.getString("telephone");
                        personEmail = jsonObject.getString("email");
                    }catch (JSONException je){

                    }catch (ParseException pe){

                    }

this is email button

  emailPerson = (Button)findViewById(R.id.individualEmail);
            emailPerson.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent i = new Intent(Intent.ACTION_SEND);
                    i.setData(Uri.parse("mailto:"));
                    i.setType("plain/text");
                    i.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {personEmail});
                    startActivity(i);
                }
            });
            if(personEmail==null || personEmail.equals("")  || personEmail.equals(" ")){
                emailPerson.setClickable(false);
                emailPerson.setEnabled(false);
                emailPerson.setVisibility(View.GONE);
            }
            else{
                emailPerson.setEnabled(true);
                emailPerson.setClickable(true);
                emailPerson.setVisibility(View.VISIBLE);
            }


here it is working fine but this is a different table in same database . >in this table there is no hidden password field

try{
                            corporateEmail = jsonObject.getString("email");
                            if(corporateEmail == null || corporateEmail.equals("")){
                                emailCorporate.setVisibility(View.GONE);
                                emailCorporate.setEnabled(false);
                                emailCorporate.setClickable(false);
                            }


emailCorporate = (Button) findViewById(R.id.corporateEmail);
        emailCorporate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(Intent.ACTION_SEND);
                i.setData(Uri.parse("mailto:"));
                i.setType("plain/text");
                i.putExtra(Intent.EXTRA_EMAIL, new String[] {corporateEmail});
                startActivity(i);
            }
        });


 private JSONObject parseObjectToJson(ParseObject parseObject) throws ParseException, JSONException, com.parse.ParseException {
        JSONObject jsonObject = new JSONObject();
        parseObject.fetchIfNeeded();
        Set<String> keys = parseObject.keySet();
        for (String key : keys) {
            Object objectValue = parseObject.get(key);
            if (objectValue instanceof ParseObject) {
                jsonObject.put(key, parseObjectToJson(parseObject.getParseObject(key)));
            } else if (objectValue instanceof ParseRelation) {
            } else {
                jsonObject.put(key, objectValue.toString());
            }
        }
        return jsonObject;
    }

解决方案

if jsonObject is not null check to see if the parse database you are pulling your data from has the the "email" tag

这篇关于ANDROID:电子邮件客户端接收者电子邮件 ID 在 android-parse 中为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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