{"id":15638,"date":"2022-10-12T10:10:02","date_gmt":"2022-10-12T04:40:02","guid":{"rendered":"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/"},"modified":"2022-10-12T10:10:02","modified_gmt":"2022-10-12T04:40:02","slug":"solved-string-not-returned-closed","status":"publish","type":"post","link":"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/","title":{"rendered":"[Solved] String not returned [closed]"},"content":{"rendered":"<p> [ad_1]<br \/>\n<\/p>\n<div id=\"answer-47566635\" class=\"answer js-answer accepted-answer js-accepted-answer\" data-answerid=\"47566635\" data-parentid=\"47566610\" data-score=\"3\" data-position-on-page=\"1\" data-highest-scored=\"1\" data-question-has-accepted-highest-score=\"1\" itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n<div class=\"post-layout\">\n<div class=\"votecell post-layout--left\"><\/div>\n<div class=\"answercell post-layout--right\">\n<div class=\"s-prose js-post-body\" itemprop=\"text\">\n<blockquote>\n<p>Your <strong><code>String result = \"\";<\/code><\/strong> is null check it Your are returning null string change it<\/p>\n<\/blockquote>\n<p>You should<\/p>\n<p><code>return  sb.toString();<\/code><\/p>\n<p>instead of <\/p>\n<p><code>return  result;<\/code><\/p>\n<p><strong>EDIT<\/strong><\/p>\n<pre><code>public class PreDefinedAttributes {\n    private Context mContext;\n    private String mobile_os, mobile_model, mobile_brand, mobile_version, mobile_manufacturer;\n    private String sdk_version, src, appname, appversion;\n    private String lat = \"\", lng = \"\", device_id;\n    private static final int REQUEST_FINE_LOCATION = 0;\n    private int height, width;\n\n\n    public PreDefinedAttributes(Context context) {\n        mContext = context;\n\n        this.mobile_model = android.os.Build.MODEL;\n        this.mobile_os = \"Android\";\n        this.mobile_brand = Build.BRAND + \" \" + Build.PRODUCT;\n        this.mobile_version = Build.VERSION.RELEASE;\n        this.mobile_manufacturer = Build.MANUFACTURER;\n\n        this.sdk_version = 16 + \"\";\n        this.src = 16 + \"\";\n        this.device_id = 16 + \"\";\n        try {\n            this.appversion = mContext.getPackageManager().getPackageInfo(mContext.getPackageName(), 0).versionName;\n        } catch (Exception e) {\n            this.appversion = \"\";\n        }\n\n        final PackageManager pm = mContext.getPackageManager();\n        ApplicationInfo ai;\n        try {\n            ai = pm.getApplicationInfo(mContext.getPackageName(), 0);\n        } catch (final PackageManager.NameNotFoundException e) {\n            ai = null;\n        }\n        this.appname = (String) (ai != null ? pm.getApplicationLabel(ai) : \"(unknown)\");\n\n\n        height = Resources.getSystem().getDisplayMetrics().heightPixels;\n        width = Resources.getSystem().getDisplayMetrics().widthPixels;\n\n\n        \/\/loadPermissions(Manifest.permission.ACCESS_FINE_LOCATION,REQUEST_FINE_LOCATION);\n\n\n    }\n\n    public int getHeight() {\n        return height;\n    }\n\n    public int getWidth() {\n        return width;\n    }\n\n    public String getDevice_id() {\n        return device_id;\n    }\n\n    public String getMobile_brand() {\n        return mobile_brand;\n    }\n\n\n    public String getMobile_model() {\n        return mobile_model;\n    }\n\n    public String getMobile_os() {\n        return mobile_os;\n    }\n\n    public String getMobile_version() {\n        return mobile_version;\n    }\n\n    public String getMobile_manufacturer() {\n        return mobile_manufacturer;\n    }\n\n    public String getSdk_version() {\n        return sdk_version;\n    }\n\n    public String getSrc() {\n        return src;\n    }\n\n    public String getAppname() {\n        return appname;\n    }\n\n    public String getAppversion() {\n        return appversion;\n    }\n\n    public String getLat() {\n        return lat;\n    }\n\n    public String getLng() {\n        return lng;\n    }\n}\n<\/code><\/pre>\n<p><strong>get values like this<\/strong><\/p>\n<pre><code> PreDefinedAttributes preDefinedAttributes = new PreDefinedAttributes(this);\n\n\n        StringBuffer sb = new StringBuffer();\n        sb.append(\"&amp;_vpw=\" + preDefinedAttributes.getWidth());\n        sb.append(\"&amp;_vph=\" + preDefinedAttributes.getHeight());\n        sb.append(\"&amp;sdk_version=\" + preDefinedAttributes.getSdk_version());\n        sb.append(\"&amp;_src=android-sdk\"\n                + \"&amp;_os=\" + preDefinedAttributes.getMobile_os());\n        sb.append(\"&amp;os_version=\" + preDefinedAttributes.getMobile_version());\n        sb.append(\"&amp;manufacturer=\" + preDefinedAttributes.getMobile_manufacturer());\n\n        Log.e(\"Builder Params \" , sb.toString());\n<\/code><\/pre>\n<p><strong>OUtput<\/strong><\/p>\n<p><a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/10\/Solved-String-not-returned-closed.png\"><img decoding=\"async\" src=\"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/10\/Solved-String-not-returned-closed.png\" alt=\"enter image description here\"><\/a><\/p>\n<\/p><\/div>\n<div class=\"mt24\"><\/div>\n<\/div>\n<p>            <span class=\"d-none\" itemprop=\"commentCount\">5<\/span> <\/p><\/div>\n<\/div>\n<p>[ad_2]<\/p>\n<p>solved String not returned [closed] <\/p>\n","protected":false},"excerpt":{"rendered":"<p>[ad_1] Your String result = &#8220;&#8221;; is null check it Your are returning null string change it You should return sb.toString(); instead of return result; EDIT public class PreDefinedAttributes { private Context mContext; private String mobile_os, mobile_model, mobile_brand, mobile_version, mobile_manufacturer; private String sdk_version, src, appname, appversion; private String lat = &#8220;&#8221;, lng = &#8220;&#8221;, device_id; &#8230; <a title=\"[Solved] String not returned [closed]\" class=\"read-more\" href=\"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/\" aria-label=\"More on [Solved] String not returned [closed]\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[320],"tags":[452,323,362],"class_list":["post-15638","post","type-post","status-publish","format-standard","hentry","category-solved","tag-android","tag-java","tag-string"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Solved] String not returned [closed] - JassWeb<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Solved] String not returned [closed] - JassWeb\" \/>\n<meta property=\"og:description\" content=\"[ad_1] Your String result = &quot;&quot;; is null check it Your are returning null string change it You should return sb.toString(); instead of return result; EDIT public class PreDefinedAttributes { private Context mContext; private String mobile_os, mobile_model, mobile_brand, mobile_version, mobile_manufacturer; private String sdk_version, src, appname, appversion; private String lat = &quot;&quot;, lng = &quot;&quot;, device_id; ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/\" \/>\n<meta property=\"og:site_name\" content=\"JassWeb\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-12T04:40:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/10\/Solved-String-not-returned-closed.png\" \/>\n<meta name=\"author\" content=\"Kirat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kirat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/\"},\"author\":{\"name\":\"Kirat\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\"},\"headline\":\"[Solved] String not returned [closed]\",\"datePublished\":\"2022-10-12T04:40:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/\"},\"wordCount\":34,\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/10\/Solved-String-not-returned-closed.png\",\"keywords\":[\"android\",\"java\",\"string\"],\"articleSection\":[\"Solved\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/\",\"url\":\"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/\",\"name\":\"[Solved] String not returned [closed] - JassWeb\",\"isPartOf\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/10\/Solved-String-not-returned-closed.png\",\"datePublished\":\"2022-10-12T04:40:02+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/#primaryimage\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/10\/Solved-String-not-returned-closed.png\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/10\/Solved-String-not-returned-closed.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jassweb.com\/solved\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Solved] String not returned [closed]\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jassweb.com\/solved\/#website\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"name\":\"JassWeb\",\"description\":\"Build High-quality Websites\",\"publisher\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jassweb.com\/solved\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jassweb.com\/solved\/#organization\",\"name\":\"Jass Web\",\"url\":\"https:\/\/jassweb.com\/solved\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"contentUrl\":\"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png\",\"width\":693,\"height\":132,\"caption\":\"Jass Web\"},\"image\":{\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31\",\"name\":\"Kirat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"contentUrl\":\"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750\",\"caption\":\"Kirat\"},\"sameAs\":[\"http:\/\/jassweb.com\"],\"url\":\"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Solved] String not returned [closed] - JassWeb","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/","og_locale":"en_US","og_type":"article","og_title":"[Solved] String not returned [closed] - JassWeb","og_description":"[ad_1] Your String result = \"\"; is null check it Your are returning null string change it You should return sb.toString(); instead of return result; EDIT public class PreDefinedAttributes { private Context mContext; private String mobile_os, mobile_model, mobile_brand, mobile_version, mobile_manufacturer; private String sdk_version, src, appname, appversion; private String lat = \"\", lng = \"\", device_id; ... Read more","og_url":"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/","og_site_name":"JassWeb","article_published_time":"2022-10-12T04:40:02+00:00","og_image":[{"url":"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/10\/Solved-String-not-returned-closed.png","type":"","width":"","height":""}],"author":"Kirat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kirat","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/#article","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/"},"author":{"name":"Kirat","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31"},"headline":"[Solved] String not returned [closed]","datePublished":"2022-10-12T04:40:02+00:00","mainEntityOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/"},"wordCount":34,"publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"image":{"@id":"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/#primaryimage"},"thumbnailUrl":"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/10\/Solved-String-not-returned-closed.png","keywords":["android","java","string"],"articleSection":["Solved"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/","url":"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/","name":"[Solved] String not returned [closed] - JassWeb","isPartOf":{"@id":"https:\/\/jassweb.com\/solved\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/#primaryimage"},"image":{"@id":"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/#primaryimage"},"thumbnailUrl":"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/10\/Solved-String-not-returned-closed.png","datePublished":"2022-10-12T04:40:02+00:00","breadcrumb":{"@id":"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/#primaryimage","url":"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/10\/Solved-String-not-returned-closed.png","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/uploads\/2022\/10\/Solved-String-not-returned-closed.png"},{"@type":"BreadcrumbList","@id":"https:\/\/jassweb.com\/solved\/solved-string-not-returned-closed\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jassweb.com\/solved\/"},{"@type":"ListItem","position":2,"name":"[Solved] String not returned [closed]"}]},{"@type":"WebSite","@id":"https:\/\/jassweb.com\/solved\/#website","url":"https:\/\/jassweb.com\/solved\/","name":"JassWeb","description":"Build High-quality Websites","publisher":{"@id":"https:\/\/jassweb.com\/solved\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jassweb.com\/solved\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jassweb.com\/solved\/#organization","name":"Jass Web","url":"https:\/\/jassweb.com\/solved\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/","url":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","contentUrl":"https:\/\/jassweb.com\/wp-content\/uploads\/2021\/02\/jass-website-logo-1.png","width":693,"height":132,"caption":"Jass Web"},"image":{"@id":"https:\/\/jassweb.com\/solved\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/65c9c7b7958150c0dc8371fa35dd7c31","name":"Kirat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jassweb.com\/solved\/#\/schema\/person\/image\/","url":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","contentUrl":"https:\/\/jassweb.com\/solved\/wp-content\/litespeed\/avatar\/1261af3c9451399fa1336d28b98ea3bb.jpg?ver=1775798750","caption":"Kirat"},"sameAs":["http:\/\/jassweb.com"],"url":"https:\/\/jassweb.com\/solved\/author\/jaspritsinghghumangmail-com\/"}]}},"_links":{"self":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/15638","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/comments?post=15638"}],"version-history":[{"count":0,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/posts\/15638\/revisions"}],"wp:attachment":[{"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/media?parent=15638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/categories?post=15638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jassweb.com\/solved\/wp-json\/wp\/v2\/tags?post=15638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}