I am trying to work on an application to read SA citizenship ID on Android Studio but when I run the application it is not even opening?  The Source Code :  package com.example.magicidapplication;  import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView;  public class MainActivity extends AppCompatActivity {  EditText etID; Button btnSubmit; TextView tvResults;  @Override protected void onCreate(Bundle savedInstanceState) {     super.onCreate(savedInstanceState);     setContentView(R.layout.activity_main);      etID = findViewById(R.id.etID);     btnSubmit = findViewById(R.id.btnSubmit);     tvResults = findViewById(R.id.tvResults);      tvResults.setVisibility(View.GONE);      btnSubmit.setOnClickListener(new View.OnClickListener() {         @Override         public void onClick(View view) {              String idNumber = etID.getText().toString().trim();              String dob =idNumber.substring(0,6);              int gender = Integer.parseInt(Character.toString(idNumber.charAt(6)));              String sGender;              if(gender&lt;5)                 sGender = getString(R.string.female);             else                 sGender = getString(R.string.male);              int nationality = Integer.parseInt(Character.toString(idNumber.charAt(10)));              String sNationality;              if(nationality == 0)                 sNationality = getString(R.string.sacit);             else                 sNationality = getString(R.string.permanentresident);              String text = getString(R.string.dob) + dob +  getString(R.string.newline) +                     getString(R.string.gender) + sGender +  getString(R.string.newline) +                     getString(R.string.nationality) + sNationality;              tvResults.setText(text);              tvResults.setVisibility(View.VISIBLE);             }         });     } }   Error :     2019-03-09 17:34:40.900 5053-5053/com.example.magicidapplication E/AndroidRuntime: FATAL EXCEPTION: main       Process: com.example.magicidapplication, PID: 5053       java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.magicidapplication/com.example.magicidapplication.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.TextView.setVisibility(int)' on a null object reference           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2778)           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)           at android.app.ActivityThread.-wrap11(Unknown Source:0)   I got error like this what to do.
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?
108155
Just by curiosity, since I wasn't able to find an answer after googling, do you know what are these "codes" after the packages names of my apps in /data/app/…?  This number is neither in androidmanifest.xml, nor in cert.sf, nor in manifest.mf (inside the meta-inf folder).  For example the package name of Clash of Clans is followed by the "code": com.supercell.clashofclans-Bd6GIb47XTzpL16jgR1kZA==
61126
I am getting java.lang.NullPointerException while executing my test case , I am using Page Object Modle with PageFactory ,following are the code snippets  LoginPageObjec.java  public class LoginPageObjects {      @FindBy(xpath=".//*[@id='userName']")     private WebElement email;      @FindBy(xpath=".//*[@id='password']")     private WebElement password;      @FindBy(xpath=".//*[@id='loginFormSubmit']")     private WebElement loginBtn;      public void EnterUserName(String userName)     {         email.sendKeys(userName);     }      public void EnterPassword(String pass)     {         password.sendKeys(pass);     }      public void clickLogin()     {         loginBtn.click();     }   }   LoginTC.java  public class LoginTC extends BasePage{     private WebDriver driver;      @Test     public void login()     {         LoginPageObjects loginPage = PageFactory.initElements(driver, LoginPageObjects.class);         loginPage.EnterUserName("test.hr@domin.com.pk");         loginPage.EnterPassword("test");         loginPage.clickLogin();     } public void login1()         {             LoginPageObjects loginPage = PageFactory.initElements(driver, LoginPageObjects.class);             loginPage.EnterUserName("test.hr@domin.com.pk");             loginPage.EnterPassword("test");             loginPage.clickLogin();         }  }   BasePage.java  public class BasePage {     private WebDriver driver;      @BeforeMethod       public void initializeBrowser() {      driver=new FirefoxDriver();      driver.navigate().to("https://nexthrm-dev.vteamslabs.com/");      driver.manage().window().maximize();      }     @AfterMethod     public void closeBrowser()     {         driver.close();     }  }   I've extended BasePage class to utilize the (initialBrowser &amp; closeBrowser) functions in my test case but its producing nullpointer exception if I copy both of the functions (initialBrowser &amp; closeBrowser) into my LoginTC (testcase class) it works like charm but I dont want this redundant code i.e((initialBrowser &amp; closeBrowser) for all my testcases class could anyone explain why I am getting nullpointer exception
121434
I have a siteRegistrationController which is creating portal users as below:  Registration Controller:  public class SiteRegistrationController{      public void createPortalUser(){         //There is code to populate the values for variables u and acc.         String userId = Site.createPortalUser(u, acc.Id,null,false);             System.debug('userId is '+userId);     }  }   I am trying to test the above code and below is in my test class:  Test Class:  public class SiteRegistrationController_TEST{          SiteRegistrationController controllerObj = new SiteRegistrationController();          User guestUserObj = new User(username='testsfsdfsd@test.com',                                 IsActive=TRUE,                                 FirstName='test',                                 LastName='test',                                 Email='testsdfsd@test.com',                                 Alias='test',                                 timezonesidkey='America/Los_Angeles',                                 localesidkey='en_US',                                 emailencodingkey='UTF-8',                                 languagelocalekey='en_US');         insert guestUserObj;          System.runAs(guestUserObj){             controllerObj.createPortalUser();            } }   Site.createPortalUser is always returning null in test context.    -- This post is also about same problem but no solution here.  -- This post suggests that use the System.runAs(guestUser) but does not specify how to create guest user.   If any body has solution for this..Please help me. Thanks in Advance!
53628
I have a Samsung Galaxy S3. Android version 4.3  I downloaded the official StackExchange app today. I am not able to view post related to android tag from my profile. I tried refreshing also  Snap     Edit:  However i am able to see one post for the relevant from the drop down list    Edit 2:  I tried what Steven V suggested. However it's the same.    I tried for a different user its the same.
31740
So code blocks in questions and answers on the android app (inline included) seem to be scared of me putting my finger in them. When I poke them, they only move over two columns!  (For clarity, these are the code blocks that overlap the TextArea view because they've been eating too much)  The intended behaviour here is that when I press my finger into a code block, the touch event should register a drag; at current, I try to scroll inside a code block and I end up switching to question or answer view instead, over and over.  EDIT:  Something tells me this is status-bydesign because the text is deliberately cut off (probably inviting you to click on the code block and expand it; UX Decision?):
42604
here is my code in which i am trying to get the product name from opportunity line item but its returning back NULL value. can anyone please help me to get that product name. I can get id from product2 but i want the name of product so that i can abbreviate it and can store it in Order_Name__c field of orderItem. After adding the product only i am firing this trigger.     public class Procuct_Adding_To_Order{  public static void productOrder(List&lt;OpportunityLineItem&gt; oli){     system.debug('-----------------------');      set&lt;id&gt; prodset = new set&lt;Id&gt;(); for(OpportunityLineItem item : oli) {   prodSet.add(item.product2id); } // collect products Map&lt;Id, product2&gt; prodMap = new Map&lt;Id, Product2&gt;([select name from product2 where id in :prodSet]);   // create a map for OLIid &amp; corresponding Product Name Map&lt;Id, string&gt; OLIprodMap = new Map&lt;Id, string&gt;();  for(OpportunityLineItem item : oli) {  OLIprodMap.put(item.id, OLIprodMap.get(oli.product2id).name); //getting Error in this line. }      set&lt;Id&gt; setOppId = new set&lt;Id&gt;();      for(OpportunityLineItem obj: oli){          setOppId.add(obj.OpportunityId);      }      list&lt;opportunity&gt; needed = [Select Master_Opportunity__c from opportunity Where Opportunity.id =: setOppId];         List&lt;OrderItem&gt; orderIt = new List&lt;OrderItem&gt;();     for(Order ord: [Select id from Order where opportunityId =: needed[0].Master_Opportunity__c])       {        for(OpportunityLineItem o : oli)        {           OrderItem op = new OrderItem();          op.Opportunity_del__c = needed[0].Master_Opportunity__c;          op.orderId = ord.id;         op.Order_Name__c = o.product2Id;         system.debug('-----------------------3333333333333333333333'+ o.Product2Id);         op.PriceBookEntryId = o.PriceBookEntryId;         op.Quantity = o.Quantity;         op.UnitPrice = 100;         orderIt.add(op);            }          }     upsert orderIt;  } }
104707
I have tried multiple actions but it is not working.  It always close the first tab and then it open link in the same page.  // Driver is launched package WebBrowserCommands;  import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.interactions.Actions;  public class OpenBrowser   {     public static void main(String[] args) throws Exception {         System.setProperty("webdriver.chrome.driver","/Users/ss108/Desktop/Util/SELENIUM SUPPORT/chromedriver");          WebDriver driver = new ChromeDriver();          driver.manage().window().maximize();         // Driver is launched          //We have two ways         boolean Indriectway = true;         //Boolean to understand both method          if(!Indriectway){             //Using String to take value.             String URL = "https://www.google.com";             driver.get(URL);              String PageSourceFirst = driver.getPageSource();             //We have took title in PageSourceFirst             System.out.println(PageSourceFirst);              //Get Title Command             String TitleFrist = driver.getTitle();             //We have took title in TitleFirst             System.out.println("Tile of WebSite is " + TitleFrist);              //Get Current URL             String CurrentURLFirst = driver.getCurrentUrl();             System.out.println("Current URL is " + CurrentURLFirst);              Actions act=new Actions(driver);             act.contextClick(driver.findElement(By.linkText("Gmail"))).perform();             Thread.sleep(10000);             act.contextClick(driver.findElement(By.linkText("Gmail"))).sendKeys(Keys.ARROW_DOWN).sendKeys(Keys.RETURN).build().perform();                    // Try to open page using right click and action arrow down **but it is not working**              driver.close();          }else {             //Using directly             driver.get("https://www.facebook.com");             String PageSourceSecond = driver.getPageSource();             System.out.println(PageSourceSecond);              //Get Title Command             System.out.println("Tile of WebSite is " + driver.getTitle());             //Get Current URL             System.out.println("Current URL is " + driver.getCurrentUrl());             driver.quit();          }     } }   Second method  1- Same result getting   System.setProperty("webdriver.chrome.driver","/Users/ss108/Desktop/Util/SELENIUM SUPPORT/chromedriver");     WebDriver driver = new ChromeDriver();     driver.get("https://www.facebook.com")     Robot robot = new Robot();     robot.keyPress(KeyEvent.VK_META);     robot.keyPress(KeyEvent.VK_T);     robot.keyRelease(KeyEvent.VK_T);     robot.keyRelease(KeyEvent.VK_META);       driver.get("https://www.google.com")   Third method  String selectLinkOpeninNewTab = Keys.chord(Keys.CONTROL,Keys.RETURN);  driver.findElement(By.linkText("urlLink")).sendKeys(selectLinkOpeninNewTab);   however none of them work for what I am trying.
77080
This may sound repititve question. But the error incurs after following multiple links found like:  and .  The controller:  public with sharing class SFLoginCtrlr {     public static HTTPResponse getResp(String loginCred){         Map&lt;String, Object&gt; mapLoginCred = (Map&lt;String, Object&gt;)JSON.deserializeUnTyped(loginCred);         String username = ''+mapLoginCred.get('username');         String password = ''+mapLoginCred.get('password');         HttpRequest req = new HttpRequest();         req.setMethod('POST');            req.setTimeout(60000);         req.setEndpoint('https://www.salesforce.com/services/Soap/u/29.0');         req.setHeader('Content-Type', 'text/xml;charset=UTF-8');                 req.setHeader('SOAPAction', '""');         req.setBody('&lt;Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;Header/&gt;&lt;Body&gt;&lt;login xmlns="urn:partner.soap.sforce.com"&gt;&lt;username&gt;' +username+ '&lt;/username&gt;&lt;password&gt;' + password + '&lt;/password&gt;&lt;/login&gt;&lt;/Body&gt;&lt;/Envelope&gt;');                 HttpResponse res = new Http().send(req);         return res;     } }   The mock class:  @isTest global class ExampleCalloutMock implements HttpCalloutMock{   global HttpResponse respond(HTTPRequest req){     HttpResponse res = new HttpResponse();     res.setStatus('OK');     res.setStatusCode(200);     res.setBody('SUCCESS');     return res;   } }   The test class:  @isTest private class SFLoginCtrlrTest{     static testMethod void SFLoginCtrlrTestMethod(){         Test.startTest();          Test.setMock(HttpCalloutMock.class, new ExampleCalloutMock());          Map&lt;String, String&gt; logincred = new Map&lt;String, String&gt;();         logincred.put('username', 'dummy@user.com');         logincred.put('password', 'notapassword');          SFLoginCtrlr.getResp(JSON.serialize(logincred));          Test.stopTest();     } }   The error received while running test class:     Methods defined as TestMethod do not support Web service callouts   Not sure, where is the issue...
80051
I wrote my own apex class with the following code:  @AuraEnabled     public static String getSessionId(){         return UserInfo.getSessionId();     }   This code works when I import it into my Lightning component. I retrieves a session id but it is invalid. If i try to do the same thing inside an apex page it works perfectly and it gives me a working session id. How can I retrieve a working session id?
84577
Just updated the mountain lion, and download the latest Eclipse 4.2 to upgrade the old one. However when opening the application, it shows that it is from an unidentified developer and the gatekeeper refuses to open it.  I know that there is an option to change the security and privacy option to allow it, however I want to know whether there is a way to just add eclipse into the list. Any hint on this?  More information: before updating I have the Eclipse 3.7.2 on machine, and after updating it works smoothly (I think I have added it into the allow list). So is there a way to do this to Eclipse 4.2?  Thanks in advance!
78597
I keep getting the System.NullPointerException: Attempt to de-reference a null object on my trigger at line 21. I've attempted to add != null to that line and I get an error too. Please see the code below.  trigger UpdateDMAAccount on Account (before insert, before update) { //get set of Postal Codes from leads to be inserted or updated Set&lt;String&gt; BillingpostalCodes = new Set&lt;String&gt;(); for(Account l : trigger.new){ if(l.BillingPostalCode != null){     BillingpostalCodes.add(l.BillingPostalCode);  } } if(BillingpostalCodes.size() &gt; 0){ //create Map of custom object records with Name (PostalCode) as key Map&lt;String,DMA_Value__c&gt; validBillingPostalCode = new Map&lt;String,DMA_Value__c&gt;(); for(DMA_Value__c obj : [SELECT Id, Name, DMA_Value__c FROM DMA_Value__c WHERE Name IN :BillingpostalCodes]){     validBillingPostalCode.put(obj.Name,obj); } for(Account l : trigger.new){     if((Trigger.isInsert || trigger.oldMap.get(l.Id).BillingPostalCode != l.BillingPostalCode) &amp;&amp; validBillingPostalCode.containsKey(l.BillingPostalCode)){          l.DMA__c = validBillingPostalCode.get(l.BillingPostalCode).DMA_Value__c;     }     else if(trigger.oldMap.get(l.Id).BillingPostalCode != NULL || l.BillingPostalCode &amp;&amp; !validBillingPostalCode.containsKey(l.BillingPostalCode)){         //blank value if new PostalCode does not match a record in the Map         l.DMA__c = Null;     }   }  } }
43223
I used Link2SD and Titanium too. Both of them failed. I want to convert a GPS Spoofer to system app. I tried to move it manually,  but in all 3 cases, the app is completely removed from the drawer. Is there any method?  I am on Samsung J200G rooted with TWRP flashing.
39520
I opened the Android app and was met by the "Loading stack exchange sites" splash screen. The spinner froze, then a black screen appeared, then the entire app froze. I tried a few more times and was met with the same results.  The full site also works fine on my phone, so it appears to just be the app.   On the iPhone app, I keep getting a "Request timed out. Tap to retry." message when loading the question body. The title gets loaded, as is the HNQ list and my own notifications, but no posts. The mobile site is working.    Requests to the API never load:
71370
I was trying to look for an answer of mine earlier and did a search like this:  user:me SQLite RunInTransaction   The above found nothing. So I changed it to  user:me SQLite   Which found a bunch of things. I dug through the results and saw this snippet for :     From my experience, wrapping as many database calls as possible into a transaction speeds things up quite a bit: using (var db = new SQLiteConnection(dbPath)) { db.RunInTransaction(() => { …    Notice that the snippet contains both "SQLite" and "RunInTransaction". In looking at the post itself I noticed "SQLite" was in the question title and in my answer as code. I also noticed that "RunInTransaction" is only in my answer in code.  I looked at meta and saw , which says I need to prefix any code with code:, so I tried:  user:me SQLite code:RunInTransaction user:me code:SQLite code:RunInTransaction   None of the above returned any results.  I also found  on meta which says I can search for code like this (without the code: prefix):        So I tried:  SQLite RunInTransaction "SQLite RunInTransaction"   The first did not return my answer. The second did not return any results.  So my question:  How do I properly search for , that has both "SQLite" and "RunInTransaction" in the post?
121948
If I select a feature and run self.iface.actionIdentify().trigger() it will open the identify window but won't open the selected feature's data, how can I make it open the data of the selected feature?
57540
I'm trying to update an account list and I need to get the Ids when the update fails.  I use the getId() method but for accounts which fail I get null.  It's an update so my account already has an Id.  Is it normal ? If it is, how can I get the Ids list of non-updated accounts ?  Here is my code :  List&lt;Account&gt; accountsList = [select Id from Account];  for(Account a : accountsList) {     a.Name = 'Test', }  List&lt;Database.SaveResult&gt; res = Database.update(accountsList, false);  for (Database.SaveResult s : res) {     if (!s.isSuccess()) {         system.debug(s.getId()); // I get null here      }  }