Hello stackoverflow world! There comes a time when the answer you're looking for is not already here and so you'll have to ask.  My issue is I'm checking for null values using an if statement and I'm still getting a NullPointerException.  I'm having my app tested by someone and they run into a NullPointerException but I'm not able to recreate the bug for the life of me. making it harder to pinpoint the issue.  This is the CrashReport on dev console for the app:  java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dev.admin.blacklist/com.dev.admin.blacklist.Page_RecentCalls}: java.lang.NullPointerException     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2391)     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2442)     at android.app.ActivityThread.access$800(ActivityThread.java:166)     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1357)     at android.os.Handler.dispatchMessage(Handler.java:110)     at android.os.Looper.loop(Looper.java:193)     at android.app.ActivityThread.main(ActivityThread.java:5387)     at java.lang.reflect.Method.invokeNative(Native Method)     at java.lang.reflect.Method.invoke(Method.java:515)     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:831)     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:647)     at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException     at com.dev.admin.blacklist.Page_RecentCalls.getRecentContacts(Page_RecentCalls.java:110)     at com.dev.admin.blacklist.Page_RecentCalls.onCreate(Page_RecentCalls.java:32)     at android.app.Activity.performCreate(Activity.java:5363)     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2335)     ... 11 more   and this is the line 110 that is throwing this error:      Cursor cursor = getContentResolver().query(queryUri, projection, null, null, sortOrder);       while (cursor.moveToNext())     {         String phoneNumber =  cursor.getString(cursor.getColumnIndex(CallLog.Calls.NUMBER));         String title = (cursor.getString(cursor.getColumnIndex(CallLog.Calls.CACHED_NAME)));         if(phoneNumber != null &amp;&amp; !phoneNumber.isEmpty() &amp;&amp; !phoneNumber.equals(manager.getVoiceMailNumber().toString()))         {             if(title == null || title.isEmpty())title = "No-name";             if(recentcontacts.size() &gt; 1 )             {                 String one = "";                  one = recentcontacts.get(recentcontacts.size() - 1).getFirst(); //Line 110 error was here                 if(!one.equals(title)) recentcontacts.add(new Object_TwoString(title,phoneNumber));             }             else  recentcontacts.add(new Object_TwoString(title,phoneNumber));         }      }     cursor.close();     return recentcontacts; } }     public Object_TwoString(String one, String two) {     setStrings(one,two); }  public String[] getStrings(){ String[] strings = {firstString,secondString}; return strings;} public String getFirst(){return firstString;} public String getSecond(){return secondString;}  public Boolean IsContained(List&lt;Object_TwoString&gt; obj) {     for(Object_TwoString  ts: obj)     {         if(ts.getFirst().equals(firstString) &amp;&amp; ts.getSecond().equals(secondString))return true;     }     return false; }
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?
Subdivision Surface not making things smooth as they are in the tutorial I am following Why are ammeters used in series and voltmeters in parallel? Radius of Convergence of power series of Complex Analysis I have come across the following few questions on past exams papers.. I know how to solve these type when it is of the form $a_nz^n$ but don't have a clue what to do with these. Any help would be greatly appreciated!  (i) $\displaystyle\sum_{n=0}^\infty \bigg(\dfrac{1}{2n}\bigg)z^{3n}$.  (ii) $\displaystyle\sum_{n=0}^\infty(2^n+i)(z-i)^n$.  (iii) Show that the radius of convergence of $\displaystyle\sum_{n=0}^\infty z^{n!}$ is $1$ and that there are infinitely many $z \in \mathbb{C}$ with $|z|=1$ for which the series diverges. Proof of $a^n+b^n$ divisible by $a+b$ when $n$ is odd I read somewhere that     $(a^n - b^n)$         It is always divisible by $a-b$.   When $n$ is even it is also divisible by $a+b$.   When $n$ is odd it is not divisible by $a+b$.      and     $(a^n + b^n)$         It is never divisible by $a-b$.   When $n$ is odd it is divisible by $a+b$.   When $n$ is even it is not divisible by $a+b$.      I wonder what's the proof for this.  First postulate is clear. $(a-b)$ would or would not be a factor. Any light on others? Will adding more RAM speed up my computer? Apparently, you can speed up your computer by adding more RAM. Is the amount of ram to be added is directly or indirectly related to the amount of hard-disk  space, processor speed, Motherboard etc... Can the memory of a RAM be compared with Virtual Memory and Cache Memory?  Note: About my PC Configuration: Intel core i5 processor, Motherboard DP55WB 4GB RAM, 700 GB Hard-disk space. What does "Meta" mean? I am fairly new to Stack Overflow and just stumbled across Meta Stack Overflow.  I can't seem to figure out what the purpose of the "Meta" site is. Can someone please explain it to me? How to make 'python' program command execute Python 3? The python program command executes Python 2. Python 3 can be executed using the python3 command.  How can Python 3 be executed using the python command? Swing's KeyListener and multiple keys pressed at the same time I found this interesting problem in :     Given a point $P$ in space, and given a piece of malleable material of constant density, how should you shape and place the material in order to create the largest possible gravitational field at $P$?   Any ideas? Datasets constructed for a purpose similar to that of Anscombe's quartet I've just come across  (four datasets that have almost indistinguishable descriptive statistics but look very different when plotted) and I am curious if there are other more or less well-known datasets that have been created to demonstrate the importance of certain aspects of statistical analyses. Idea behind proof that $\frac{21n+4}{14n+3}$ is irreducible for all $n$ Quantify Difference/Distance between Lognormal distributions I am trying to determine a metric that quantifies the distance between two continuous lognormal distributions. The data is actually a mixture of two lognormal distributions (I am not sure if this can be called bimodal). The individual distributions have different means but the same standard deviations. I have 20 data sets that can be divided into 4 groups, with each group having a constant standard deviation, but the 5 data sets in each group are made up of two distributions with different means. Some examples:      I am in search of a metric that accounts for the contrast (difference in means) and the standard deviation. I have tried out some parameters like coefficient of variation (of the mixture), Ashman's D etc. I have also tried percentage of overlap. However the problem always is that, at the end when plotted against the results I end up with 4 trend-lines again, corresponding to the 4 different standard deviations. Is there some other way I can quantify this?  Just to make myself clear, I want to quantify the difference between two distributions in a single case (between the red and green PDFs in the above image). Determine whether or not a point lies within a rotated rectangle How to filter a dictionary according to an arbitrary condition function? So what does Cyanogen Inc shutting down mean for CyanogenMod and similar ROMs? So Cyanogen Inc (cyngn), known for their support for their support for CyanogenMod and their efforts to integrate Cyanogen OS into devices such as the OnePlus One, Alcatel POP Mirage, and . Cyanogen Inc just recently .  What does this mean for CyanogenMod, Cyanogen OS, and the devices which originally shipped with Cyanogen OS? Will they no longer receive OTA updates? How can I use a command to delete all files in Downloads whose dates added are greater than 1 year? I am using a Mac. How can I use a command to delete all files in ~/Downloads whose dates added are greater than 1 year? In Harry Potter and the Sorcerer's Stone, Nearly-Headless Nick and some other ghosts can visit the Hogwarts students, but why can't other deceased people - such as Harry's parents? Prove that a function is not injective Where are temporary files in Chrome stored? Shapefile: "table1.shp"   Field name: "Name" Field name: "Result"   Flat file: "referenceTable"   Field name: "STREET" Field name: "AKA"   I need to compare the value "Name" in "table1.shp" to the value "STREET" in "referenceTable"  If the values are the same then put the "AKA" value into the "Result" in "table1.shp"     Here is my code.  I got stuck on accessing the elements from the array  import arcpy, os, sys, string from array import *   table1 = "G:\\xStreetNew\\table1.shp" table1_column = ['Name', 'Result'] referenceTable = "G:\\xStreetNew\\Test.gdb\\referenceTable" referenceTable_column = ['STREET', 'AKA']  referenceTable_List = [] with arcpy.da.SearchCursor(referenceTable, referenceTable_column) as rCur: for r_row in rCur:     reference_row = r_row[0].split(",")     referenceTable_List.insert(0,reference_row) ##print sorted(referenceTable_List)  Table1_Update_Cursor = arcpy.da.UpdateCursor(table1, "Name") for row in Table1_Update_Cursor:   if row[0] == None:   row[0] = row[0] else:   row[0] = row[0].replace(";",",")   Table1_Update_Cursor.updateRow(row)  table1_List = [] with arcpy.da.SearchCursor(table1, table1_column) as tCur: for t_row in tCur:     row = t_row[0].split(",")     table1_List.insert(0,row) ##print sorted(table1_List)  Table1_row = len(table1_List) Table1_column = len([table1_List]) ref_row = len(referenceTable_List) for i in range(0,Table1_row):  #Table Row   for ii in range(0,Table1_column):   #Table Column     print table1_List[i][ii]   Below was my old post.  Sorry for the confusion.  I have a shapefile named "table1.shp".     I would like to get all values from fielname "Name" from this table and put them into a list. Able to output each element from the list     So far, I'm able to create a list but not too sure how to get to value "AVENUE 33" or "CHAPMAN ST"  This is my code:  import arcpy, os, sys, string from array import *   table1 = "G:\\xStreetNew\\table1.shp" referenceTable = "G:\\xStreetNew\\Test.gdb\\referenceTable" cursor = arcpy.da.UpdateCursor(table1, "Name") for row in cursor: if row[0] == None:     row[0] = row[0] else:     row[0] = row[0].replace(";",",") cursor.updateRow(row) table1_column = ['Name'] table1_curObj = arcpy.da.SearchCursor(table1, table1_column) table1_List = [] for row in table1_curObj:    table1_row = row[0].split(",")    table1_List.insert(0,table1_row)    print table1_List[0]