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

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

问题描述

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





我的问题是






当我向电子邮件客户端检索电子邮件ID时,
电子邮件为空,即使电子邮件列有电子邮件。






注意:在另一个地方的应用程序(另一个表)中,我以相同的方式将电子邮件ID提交给电子邮件客户端,但邮件显示很好..只有在这里发生问题。



如果有人知道请帮忙?


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




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

} catch(ParseException pe){

}




这是电子邮件按钮




  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);
}







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




  try {
corporateEmail = jsonObject.getString( 电子邮件);
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)抛出ParseException,JSONException,com.parse.ParseException {
JSONObject jsonObject = new JSONObject();
parseObject.fetchIfNeeded();
设置< 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;
}


解决方案

如果jsonObject不为空检查查看您正在拉取数据的解析数据库是否具有电子邮件标签


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天全站免登陆