This might be a possible duplicate but i can't seem to pinpoint the exact solution. Camera works fine and returns the image uri on devices below api 23. However app crushes right after capturing image on devices apove api 23 with log error  java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2, result=-1, data=Intent { act=inline-data (has extras) }} to activity {ana.foodi/ana.foodi.MainActivity}: java.lang.NullPointerException: uri                                                          at android.app.ActivityThread.deliverResults(ActivityThread.java:3940)                                                          at android.app.ActivityThread.handleSendResult(ActivityThread.java:3983)                                                          at android.app.ActivityThread.-wrap16(ActivityThread.java)                                                          at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1548)                                                          at android.os.Handler.dispatchMessage(Handler.java:111)                                                          at android.os.Looper.loop(Looper.java:207)                                                          at android.app.ActivityThread.main(ActivityThread.java:5765)                                                          at java.lang.reflect.Method.invoke(Native Method)                                                          at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)                                                          at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)                                                       Caused by: java.lang.NullPointerException: uri                                                          at com.android.internal.util.Preconditions.checkNotNull(Preconditions.java:60)                                                          at android.content.ContentResolver.query(ContentResolver.java:481)                                                          at android.content.ContentResolver.query(ContentResolver.java:441)                                                          at ana.foodi.MainActivity.onActivityResult(MainActivity.java:672)   After checking with breakpoints,realised Uri (selectedImage) is null below:   @Override public void onActivityResult(int requestCode, int resultCode, Intent data) {     super.onActivityResult(requestCode, resultCode, data);     final String filePath;     if(resultCode == Activity.RESULT_OK &amp;&amp; REQUEST_POST_PHOTO==999){           if(requestCode == 2 ) {             requestRuntimePermission();             Uri selectedImage = data.getData();             String[] filePaths = {MediaStore.Images.Media.DATA};             Cursor c = this.getContentResolver().query(selectedImage, filePaths, null, null, null);             c.moveToFirst();             int columnIndex = c.getColumnIndex(filePaths[0]);             filePath = c.getString(columnIndex);             c.close();   I've tried requesting runtime permission with this   public void requestRuntimePermission() {     if (Build.VERSION.SDK_INT &gt;= 23) {         if (ContextCompat.checkSelfPermission(context,android.Manifest.permission.WRITE_EXTERNAL_STORAGE)                 != PackageManager.PERMISSION_GRANTED) {             ActivityCompat.requestPermissions(this,                     new String[]{android.Manifest.permission.WRITE_EXTERNAL_STORAGE}, 1);         }     } }   but error persist.  startActivityForResult call  REQUEST_POST_PHOTO=999;                 Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);                 startActivityForResult(cameraIntent, REQUEST_CODE_POST);
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?
I have understood how ridge regression shrinks coefficients towards zero geometrically. Moreover I know how to prove that in the special "Orthonormal Case," but I am confused how that works in the general case via "Spectral decomposition." error: no such partition. Grub rescue How do I find the particular solution of this second order inhomogenous differential equation? (Using undetermined coefficients).  $y''-4y'+5y = 4e^{2x} (\sin x)$  I can find the generel homogenous solutions but I need help for the particular. Convert generic List/Enumerable to DataTable? I have few methods that returns different Generic Lists.   Exists in .net any class static method or whatever to convert any list into a datatable? The only thing that i can imagine is use Reflection to do this.  IF i have this:  List&lt;Whatever&gt; whatever = new List&lt;Whatever&gt;();   (This next code doesn't work of course, but i would like to have the possibility of:  DataTable dt = (DataTable) whatever; After learning about the  datasets I've working with the following layers, from the USA data   Country boundaries State boundaries County boundaries City boundaries ZipCode/Postcode boundaries   What I am trying to find is the equivalent (where appropriate) of the same data for various countries.  Is there any free administrative boundaries available as shapefiles for other countries? I'm looking for specific, real cases in which a causal relationship was inappropriately inferred from evidence of a correlation.   Specifically, I'm interested in examples that meet the following criteria:   Existence of the causal relationship was accepted as fact widely enough to have notable effects (on public policy, discourse, individual decisions, etc.). The link was inferred solely on the basis of correlative evidence (perhaps along with the existence of a coherent but unproven causal mechanism).  Causality has been objectively falsified or at least called into serious doubt.   The two examples that came to mind for me aren't quite ideal:   Sodium intake and blood pressure: As I understand it, it has since been determined that salt intake only increases blood pressure in sodium-sensitive individuals. The existence of a valid causal relationship (although not quite the one that was originally accepted) make this example less compelling. Vaccines and autism: I may have the background wrong, but I believe this link was surmised on the basis of both correlations and (fraudulent) experimental evidence. This example is weakened by the fact that (fake) direct evidence existed.   Note: I've seen this similar question:    My question differs primarily in that it focuses on notable, real-world examples and not on examples in which a causal link is clearly absent (e.g., weight and musical skill). How do I print out the contents of a vector? When would you call java's thread.run() instead of thread.start()? Are $_SESSION variables stored on the client or the server? Git is automatically merging changes from a different branch to master How to distribute objects in a circular pattern on a surface (Radial Array, Polar Array) Show that $\sum\nolimits_{d|n} \frac{1}{d} = \frac{\sigma (n)}{n}$ for every positive integer $n$. Show that $\sum\nolimits_{d|n} \frac{1}{d} = \frac{\sigma (n)}{n}$ for every positive integer $n$.   where $\sigma (n)$ is the sum of all the divisors of $n$ and $\sum\nolimits_{d|n} f(d)$ is the summation of $f$ at each $d$ where $d$ is the divisor of $n$.    I have written $n=p_1^{\alpha_1}p_2^{\alpha_2}p_3^{\alpha_3}.......p_k^{\alpha_k}$ then:- $$\begin {align*} \sum\nolimits_{d|n} \frac{1}{d}&amp;=\frac{d_2.d_3......d_m+d_1.d_3......d_m+........+d_1.d_2.d_3......d_{m-1}}{d_1.d_2.d_3......d_m}  \\&amp;=\frac{d_2.d_3......d_m+d_1.d_3......d_m+........+d_1.d_2.d_3......d_{m-1}}{p_1^{1+2+...+\alpha_1}p_2^{1+2+...+\alpha_2}p_3^{1+2+....+\alpha_3}.......p_k^{1+2+....+\alpha_k}}  \\ \end{align*}$$ where $d_i$ is some divisor among the $m$ divisors. Then I cannot comprehend the numerator so that to get the desired result.  Also suggest some other approches to this question. How do I report a bug? Make Bash autocomplete guess the closest approximation I have a somewhat uncomfortable keyboard on my laptop, resulting in that I sometimes misspell things in Bash and when pressing Tab for an auto-completion nothing happens.   Is it possible to have Bash guess what I meant to type, by for example when wanting to change directory to Documents and then mistyping cd ocum[TAB], given no other folder beginning with "ocum" is present, Bash interprets it as cd Documents/ since it is the closest possible action to do?   Or is this idea terribly complicated to achieve? $G$ is the set of all subsets of a set $A$, under the operation of $\triangle\;$: Symmetric Difference of sets.  $A$ has at least two different elements.  I need to check if this is a group, and if it does to show if the group is abelian and/or finite.  Associativity - easy from Symmetric Difference. Identity element - empty group. Inverse element - each element is inverse to itself. Am I right?  abelian? finite? Proving an inequality by induction, how to figure out intermediate inductive steps? I'm working on proving the following statement using induction:  $$ \sum_{r=1}^n \frac{1}{r^2} \le \frac{2n}{n+1} $$  Fair enough. I'll start with the basis step:  Basis Step: (n=1) $$ \sum_{r=1}^n \frac{1}{r^2} \le \frac{2n}{n+1} $$ $$ \frac{1}{1^2} \le \frac{2}{1+1} $$ $$ 1 \le 1  \checkmark  $$  Inductive Step: $$ \sum_{r=1}^{n+1} \frac{1}{r^2} \le \frac{2(n+1)}{(n+1)+1} $$ $$ \sum_{r=1}^{n+1} \frac{1}{r^2} \le \frac{2(n+1)}{n+2} $$  My goal is to prove $\forall_{n\ge1} s(n) \implies s(n+1) $ or that this inequality holds true for all $n\ge1$.  I'm not quite sure to go from here on the inductive step. I understand that I need to basically work some clever substitution and manipulation into the problem to end up with: $$ \sum_{r=1}^{n+1} \frac{1}{r^2} \le \frac{2n}{n+1} $$  However, I'm not quite sure what needs to done to obtain this after attempting a few times. What are routed events and how it's different from normal events When should I use can? When should I use could? What is right under what context? Your favourite application of the Baire Category Theorem counting with max and min restrictions $$x_1 + x_2 + x_3 + x_4 = 10$$ But $x_1 \ge 1$ and $x_2 \ge2$.  Finally, $x_1&lt;6,  x_2&lt;6, x_3&lt;6$ and $x_4&lt;6$.  I started off by finding the total amount that you can get for the original equation. That would be $C (13, 3)$. Then i calculated for the cases of numbers being greater than or equal to 5. I dont know how to incorporate $x_1\ge1$ and $x_2\ge2$. Any help?  $x_1, x_2, x_3, x_4$ are all integers that could be >= 0(But $x_1$ and $x_2$ have their own restriction).