I'm following  blog post to add this feature onto my app where I can take a picture then save the picture data as a Uri for further functions. But I'm getting an error when I try to open the camera intent.     java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.XmlResourceParser android.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference   I suspect there is something wrong with the file_paths.xml but I double checked there is nothing wrong. I've done some research on different ways of saving images through like FileProvider but most of it doesn't work for me either.   Does anyone know what's wrong with my code?  MainActivity  private void openCameraIntent() {     Intent pictureIntent = new Intent(             MediaStore.ACTION_IMAGE_CAPTURE);     if(pictureIntent.resolveActivity(getPackageManager()) != null){         //Create a file to store the image         File photoFile = null;         try {             photoFile = createImageFile();         } catch (IOException ex) {             // Error occurred while creating the File         }          if (photoFile != null) {             Uri photoURI = FileProvider.getUriForFile(this,                                                         com.example.camerapplication.provider", photoFile);             pictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,                     photoURI);             startActivityForResult(pictureIntent,                     REQUEST_CAPTURE_IMAGE);         }     } }  @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {     if(requestCode == REQUEST_CAPTURE_IMAGE &amp;&amp; resultCode == RESULT_OK){         Glide.with(this).load(imageFilePath).into(image);         // TODO:Use Image Uri for further functions     } }  private File createImageFile() throws IOException{     String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(new Date());     String imageFileName = "IMG_" + timeStamp + "_";     File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES);     File image = File.createTempFile(imageFileName,".jpg",storageDir);     imageFilePath = image.getAbsolutePath();      return image; }   Manifest  &lt;uses-feature android:name="android.hardware.camera" android:required="true" /&gt;  // ... Other elements and then // Within application scope  &lt;provider     android:name="androidx.core.content.FileProvider"     android:authorities="${applicationId}.provider"     android:exported="false"     android:grantUriPermissions="true"&gt;     &lt;meta-data         android:name="android.support.FILE_PROVIDER_PATHS"         android:resource="@xml/file_paths"&gt;     &lt;/meta-data&gt; &lt;/provider&gt;   file_paths.xml  &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;paths xmlns:android="http://schemas.android.com/apk/res/android"&gt;     &lt;external-path name="my_images" path="Android/data/com.example.cameraapplication/files/Pictures" /&gt; &lt;/paths&gt;   EDITED  changed to proper path="Android/data/com.example.cameraapplication/files/Pictures"
129
What are Null Pointer Exceptions (java.lang.NullPointerException) and what causes them?  What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
123258
@RestResource(urlMapping='/Merchandise/*') global with sharing class MerchandiseManager {      @HttpGet     global static Merchandise__c getMerchandiseById() {         RestRequest req = RestContext.request;                 String merchId = req.requestURI.substring(                                   req.requestURI.lastIndexOf('/')+1);         Merchandise__c result =                         [SELECT Name,Description__c,Price__c,Total_Inventory__c                         FROM Merchandise__c                          WHERE Id = :merchId];         return result;     }      @HttpPost     global static String createMerchandise(String name,         String description, Decimal price, Double inventory) {         Merchandise__c m = new Merchandise__c(             Name=name,             Description__c=description,             Price__c=price,             Total_Inventory__c=inventory);         insert m;         return m.Id;     } }   i am trying to execute these from postman,    but throwing below error,how i can authenticate,please help urgent requirement.     {       "message": "Session expired or invalid",       "errorCode": "INVALID_SESSION_ID"   }
100055
@RestResource(urlMapping='/v/restAPIKeyGeneration/*')  global with sharing class APIforKeyGeneration{       global class Account{     public String sname;     public String bp;  }      @HttpPost     global static String CallTo(Account[] account){     system.debug('rtrtr');     String Name;     String BillingCity;     for (Account i : account) {            Name = i.sname;            BillingCity = i.bp;     }     //String key = SourceMDMRestAPI.GenerateKey(account[0].Name);     return 'key' ;     }   }   public class SourceMDMRestAPI{     public static string GenerateKey(Account acc){//how can i cal this method in my webservice Account m=new Account(Name=acc.name);     return m.id; }
96022
I had the following exception thrown at me when trying to process more than one selected records via a custom button in the list view.    Class Code  global class MerchandiseInventoryClass {      webservice static void ConverttoInventory(String[] merchandise_id)    {        //Convert Merchandise collection into Inventory Collection...         Merchandise__c[] merchandise_collection = [SELECT ID,Author__c,Book_Title__c,Edition__c,Publisher__c,Total_Merchandise_QtyTotal_Qty__c,Status__c FROM Merchandise__c WHERE ID = :merchandise_id];          Inventory__c i = new Inventory__c(); //Line 1        List&lt;Inventory__c&gt; newInventory = new List&lt;Inventory__c&gt;();        for(Merchandise__c m : merchandise_collection )        {            if(m.Status__c !='Fully Converted')            {            i.Author__c = m.Author__c ;            i.Book_Title__c = m.Book_Title__c;            i.Edition__c = m.Edition__c;            i.Publisher__c = m.Publisher__c;            i.Qty_Available__c = m.Total_Merchandise_QtyTotal_Qty__c;            i.Merchandise__c = m.Id;            m.Uninventoried_Qty__c = 0;            m.Status__c = 'Fully Converted';            newInventory.add(i);            }        }        insert newInventory;        update merchandise_collection;    }  }   By moving the Line 1 to within the for loop solved the issue for me.  Thanks to this post (refer the Best Answer in that post)    What puzzles me is that WHY i have to instantiate "i" for every iteration within the loop.  Why the list collection ("newInventory") is complaining that are duplicate elements and why should it even confuse in the first place when I am performing an "insert" even ?
32679
I have a lot of saved web pages that I want to view whenever I want without the page connecting to the web site (I can do this on WM). How do I do this on Android? Every time I click on the HTML file it says "no connection".
7315
Recently, apps that are fine an hour ago now crash when I open them. The crash report message seems to be caused by a null pointer exception (NPE) in com.google.android.trichromelibrary. Apps affected for me:  Gmail Dashlane  Is it just me, or is there actually something wrong with the library? How can I fix these affected apps? Crash report: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** Build fingerprint: 'Xiaomi/polaris/polaris:10/QKQ1.190828.002/20.9.4:user/release-keys' Revision: '0' ABI: 'arm64' Timestamp: ... pid: ..., tid: ..., name: com.dashlane &gt;&gt;&gt; com.dashlane &lt;&lt;&lt; uid: ... signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 Cause: null pointer dereference          ...  backtrace:     #00 pc 00000000038621f0 /data/app/ com.google.android.trichromelibrary 438909034-YaxP9ttrIDcQBfleP5vm7Q==/base.apk! libmonochrome_64.so (offset 0x646000) (BuildId: ... )  (click  for the screenshot of the bug report)
21759
I have a Visualforce page that renders perfectly as a PDF that I'd like to attach to an opportunity record and to attach to an email.  Whenever the code gets to getContent(), I keep getting an error saying      Too many nested getContent calls   Below, you can see the code is very simple.  Just pulls data to fit into the VF page in the substitution blanks then tries to create the PDF.  Looking at the debug log, the call to getContent() only happens once.  I'm stumped!  Thanks for your ideas...  public with sharing class GenerateThankYouLetterAsPDF {   // a handful of fields that are {!field} substitutions on the VF page     public id oppID {get; set;}     public string giftAmount {set; get;}     public string giftDate {set; get;}     //  etc...       public GenerateThankYouLetterAsPDF() {         id oppID = id.valueof( ApexPages.currentPage().getParameters().get('id') );               // set the values of field substituions           string filename = 'donation.pdf';          // Generate the PDF          PageReference pdf = ApexPages.currentPage();         system.debug ('calling getContent...');         blob b = pdf.getContent();   }                 }
17068
I want to add GPS location to RAW photos (from my EOS7D) using location data from my iPhone 5. Aperture doesn't save the data I added unless I export the RAW files as JPEGs.  I've searched the site using "  edit EXIF" to no avail.
93419
I am using Structure map like the MVC storefront by Rob Conery does and I have an AdminController and so to get to it I just type:  website/Admin/action   however if I miss spell the controller name I get the error below:  Exception Details: System.ArgumentNullException: Value cannot be null. Parameter name: key  There error occurs on this line:  Controller controller = ObjectFactory.GetInstance(controllerType) as Controller;   Does anyone have any ideas on how I can handle this error or not allow it to happen at all and maybe just goto a 404 page??  Cheers in advance
5085
I´m having problems with url parameters (req.requestURI) in my test class.  This is my code.  REST CLASS:  @RestResource(urlMapping='/Accounts/*') global class StoreController {       @HttpGet     global static String getAccounts() {           integer pageNumber=integer.valueof(RestContext.request.params.get('page'));         string  ptime=RestContext.request.params.get('time');         string  hash=RestContext.request.params.get('hash');      }   REST TEST CLASS:  @isTest private class StoreControllerTest {      static testMethod void testGet() {       //do request     RestRequest req = new RestRequest();      RestResponse res = new RestResponse();      req.requestURI = 'https://dev-my-my.cs14.force.com/mine/services/apexrest/Accounts?page=0&amp;time=1390296387&amp;hash=1wer2547';         req.httpMethod = 'GET';     RestContext.request = req;     RestContext.response = res;          String results = StoreController.getAccounts();      } }   When i run test class i get the error:  System.NullPointerException: Argument 1 cannot be null    for line :  integer pageNumber=integer.valueof(RestContext.request.params.get('page'));   Looks like parameters are not taken from url ''  when i run the test class.Please can you help me with this?
73868
I need help. I am currently trying to test this code before uploading  public class CoreValuesExt { ApexPages.StandardController sc; public boolean readonly {get; set;} public Core_Values__c cv {get; set;} public integer countEdit = 1; public string buttonValue {get; set;} public integer recordScan;  public CoreValuesExt(ApexPages.StandardController sc) {     this.sc = sc;     cv = new Core_Values__c();     cv.Account__c = sc.getid();      readonly = true;     buttonValue = 'Edit';     recordScan = [SELECT COUNT() FROM Core_Values__c WHERE Account__c = :cv.Account__c];    if (recordScan != 0){    cv = [SELECT id, HSE__c, Professionalism_Integrity__c, Quality_Accuracy__c, Technology_Innovation__c, Timeliness__c, Value_for_money__c FROM Core_Values__c WHERE Account__c = :cv.Account__c];     }  }  public ApexPages.PageReference Save() {     return sc.Save(); }  public void ApplyAction() {     countEdit++;     Integer modolus = Math.mod(countEdit, 2);     String total = cv.HSE__c + cv.Professionalism_Integrity__c + cv.Quality_Accuracy__c + cv.Technology_Innovation__c + cv.Value_for_Money__c + cv.Timeliness__c;     if(modolus == 0)     {         readonly = false;         buttonValue = 'Save';     }     else     {         if(total != 'nullnullnullnullnullnull')            {         if (recordScan == 0){         insert cv;         readonly = true;         buttonValue = 'Edit';         }         else         {         update cv;         readonly = true;         buttonValue = 'Edit';         }         }     }    }   }  With this trigger.  trigger CoreValuesTrigger on Core_Values__c (before insert) {  Core_Values__c cvs = Trigger.new; CoreValuesExt.ApplyAction(cvs);  }   But when I try to save, I get a message saying:      Illegal assignment from List to   CoreValuesExt__Core_Values__c at line 3 column 1   "  How do I go through with this? I need help. Thanks
58610
This is a follow-up to .     When I click a link to an SE site in the Android app, it gives me an "open with" pop-up that has two options:         Chrome   Stack Exchange         I can then choose to open SE posts like this "Just once" or "Always."      The problem is that when I set the SE app to "always," and I click "open in browser,"   Except, the app crashes when trying to open it in browser.  LogCat (just right after selecting "Open in browser")  01-22 18:03:36.354: E/AndroidRuntime(16064): FATAL EXCEPTION: main 01-22 18:03:36.354: E/AndroidRuntime(16064): Process: com.stackexchange.marvin, PID: 16064 01-22 18:03:36.354: E/AndroidRuntime(16064): java.lang.NullPointerException: Attempt to invoke interface method 'int java.util.List.size()' on a null object reference 01-22 18:03:36.354: E/AndroidRuntime(16064):    at com.stackexchange.marvin.utils.Helpers.getNonMarvinViewIntent(Helpers.java:452) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at com.stackexchange.marvin.ui.question.QuestionDialog$1.onClick(QuestionDialog.java:39) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:1108) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.widget.AdapterView.performItemClick(AdapterView.java:310) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.widget.AbsListView.performItemClick(AbsListView.java:1145) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.widget.AbsListView$PerformClick.run(AbsListView.java:3066) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.widget.AbsListView$3.run(AbsListView.java:3903) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.os.Handler.handleCallback(Handler.java:739) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.os.Handler.dispatchMessage(Handler.java:95) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.os.Looper.loop(Looper.java:148) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at android.app.ActivityThread.main(ActivityThread.java:5417) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at java.lang.reflect.Method.invoke(Native Method) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 01-22 18:03:36.354: E/AndroidRuntime(16064):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)   I suspect it's related to , but not sure.  Specs:   Device model: Nexus 5 Android version: Android 6.0.1 SE app version: 1.0.82 (beta) Installed browser: Chrome 47.0.2526.83 (latest at current writing)
72931
So i did quite a big trip recently, and took lots of pictures with my DSLR and occasionally Android phone. Only after coming back did i read about the whole GPX file, tracklog options in Lightroom. meaning i don't have such a tracklog file.  The android phone did geotag most photos it took. (at least, when it got a gps fix i guess)  So my question is, is there some software or way that will automatically copy the geotag from the android's photos to photos taken on the same time with my DSLR?  Or alternatively, generate a tracklog from the geotagged data in the android pictures?
35473
I factory reset my rooted Android M phone but now I realize that there was a file in the /data directory which I need.  Is it possible to create an image (.img or something similar) of the /data partition so that I could run some recovery software for ext4 on that image? I have a little knowledge about ADB.
85931
I want to open an Excel file through an Apex dialog box, then browse the information in my file line and display it with visualforce. I show you my code  public class ImportExcel {       public String fileName{get; set;}     public Blob contentFile{get;set;}     public String[] csvFileLines{get;set;}     public List&lt;String&gt; acclist{get;set;}     public String[] data{get;set;}     public ImportExcel(){         csvFileLines = new String[]{};         acclist = New List&lt;String&gt;();      } public void readFile(){         try         {             fileName=contentFile.toString();         }catch(Exception e){         ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.FATAL,'Please upload a valid CSV document');         ApexPages.addMessage(myMsg);              return ;          }         csvFileLines=fileName.split('\n');          system.debug(csvFileLines);         for(Integer i=0;i&lt;csvFileLines.size();i++){             data=csvFileLines[i].split(',');             acclist.add(data[i]);         }     } }   Once I execute my code, it puts me this error:     13:52:13:012 VARIABLE_ASSIGNMENT   [15]|e|"common.apex.runtime.impl.ExecutionException: BLOB is not a   valid UTF-8 string"|0x4e4728
95454
Anyone know which browser or what to do to upload the photo in the  process? In the form, the popup to upload the photo is working but after it closed the main form is not showing the photo and I can't continue the application.  I've tried with latest Chrome, Firefox and Microsoft Edge, but nothing is working. I tried to reach help desk information (from the website) without success.
121233
I'm trying to run an application downloaded from the internet (e.g., Jabref) but it seems that it fails silently. When I try to open it by double clicking it, nothing happens. When I use the terminal I get the following message:     LSOpenURLsWithRole() failed with error -10810 for the file .../xxxx.app   I tried several suggestions that I found here like changing permissions and modifying the Info.plist file, but nothing works.  Because it's a Java application, I tried to run it through terminal using      java -cp "CLASSPATH" MAINCLASS    and it works fine.  Just to mention that I get this error not only with this app, but for a few other applications.  Thanks in advance.