Hi guys i am getting the following exception
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources$Theme android.content.Context.getTheme()' on a null object reference --------- Stack trace --------- android.app.AlertDialog.resolveDialogTheme(AlertDialog.java:222) android.app.AlertDialog$Builder.(AlertDialog.java:452) com.skyvin.numr.scanreceipt.ReceiptDetail$convertCurrency.onPostExecute(ReceiptDetail.java:2309) com.skyvin.numr.scanreceipt.ReceiptDetail$convertCurrency.onPostExecute(ReceiptDetail.java:2199) android.os.AsyncTask.finish(AsyncTask.java:651) android.os.AsyncTask.access$500(AsyncTask.java:180) android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668) android.os.Handler.dispatchMessage(Handler.java:102) android.os.Looper.loop(Looper.java:158) android.app.ActivityThread.main(ActivityThread.java:7229) java.lang.reflect.Method.invoke(Native Method) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) ------------------------------- --------- Cause --------- -------------------------------

My code is as follows

AlertDialog.Builder builder;
LayoutInflater inflater = (LayoutInflater)
mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View layout = inflater.inflate(R.layout.currencyconvert,null);
builder = new AlertDialog.Builder(ReceiptDetail.this.getActivity());
                    builder.setTitle("Exchange Rate");
                    builder.setView(layout)
                    builder.create.show();

inthis code i am getting exception from builder.setView(layout)

What would be the reason

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.