android - Error after implementing StartApp Sdk -
i have implemented startapp sdk serve add in application giving error below. error showing in crash report. please remove error , avoid crash
please see crash report below
exception java.lang.nullpointerexception: attempt invoke interface methodjava.util.iterator java.util.list.iterator()' on null object reference com.startapp.android.publish.j.c.a () com.startapp.android.publish.j.c.a () com.startapp.android.publish.g.c.a () com.startapp.android.publish.g.d.d () com.startapp.android.publish.g.d$1.run () java.lang.thread.run (thread.java:818)
here java file
package sujaynambiar.textilecalculation; import android.app.dialog; import android.content.context; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.view.window; import android.widget.arrayadapter; import android.widget.button; import android.widget.edittext; import android.widget.imageview; import android.widget.spinner; import android.widget.textview; import android.widget.toast; import com.startapp.android.publish.startappad; import com.startapp.android.publish.startappsdk; import java.text.numberformat; import java.util.arraylist; import java.util.list; public class combertotaldraftdrafting extends appcompatactivity { edittext inputbatttension, inputfeedamount, inputnoil, inputbattweight, inputsliverhank; textview answer; spinner spinner; button calculate, buttonformula; final context context = this; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); startappsdk.init(this, "210963358", true); startappad.disablesplash(); setcontentview(r.layout.activity_comber_total_draft_drafting); getsupportactionbar().setdisplayhomeasupenabled(true); getsupportactionbar().sethomebuttonenabled(true); inputbatttension = (edittext) findviewbyid(r.id.inputbatttensioncombertotaldraft); inputbatttension.addtextchangedlistener(new numbertextwatcherforthousand(inputbatttension)); inputbattweight = (edittext) findviewbyid(r.id.inputbattweightcombertotaldraft); inputbattweight.addtextchangedlistener(new numbertextwatcherforthousand(inputbattweight)); inputnoil = (edittext) findviewbyid(r.id.inputnoilbcombertotaldraft); inputnoil.addtextchangedlistener(new numbertextwatcherforthousand(inputnoil)); inputfeedamount = (edittext) findviewbyid(r.id.inputfeedamountcombertotaldraft); inputfeedamount.addtextchangedlistener(new numbertextwatcherforthousand(inputfeedamount)); inputsliverhank = (edittext) findviewbyid(r.id.inputsliverhankcombertotaldrfat); inputsliverhank.addtextchangedlistener(new numbertextwatcherforthousand(inputsliverhank)); answer = (textview) findviewbyid(r.id.answercombertotaldraft); calculate = (button) findviewbyid(r.id.calculatecombertotaldraft); spinner = (spinner) findviewbyid(r.id.spinnerselectcountunit); list<string> list1 = new arraylist<string>(); list1.add("ne"); list1.add("ktex"); arrayadapter<string> dataadapter1 = new arrayadapter<string>(this, r.layout.custom_simple_spinner, list1); dataadapter1.setdropdownviewresource(r.layout.custom_spinner_dropdown); spinner.setadapter(dataadapter1); calculate.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { int index = spinner.getselecteditemposition(); double value1 = 0; double value2 = 0; double value3 = 0; double value4 = 0; double value5 = 0; if (inputbatttension.gettext().tostring().isempty() || inputfeedamount.gettext().tostring().isempty() || inputnoil.gettext().tostring().isempty() || inputbattweight.gettext().tostring().isempty() || inputsliverhank.gettext().tostring().isempty()) toast.maketext(getapplicationcontext(), getresources().getstring(r.string.toastmessage3), toast.length_long).show(); else { value1 = double.parsedouble(inputbatttension.gettext().tostring().replaceall(",", "")); value2 = double.parsedouble(inputfeedamount.gettext().tostring().replaceall(",", "")); value3 = double.parsedouble(inputnoil.gettext().tostring().replaceall(",", "")); value4 = double.parsedouble(inputbattweight.gettext().tostring().replaceall(",", "")); value5 = double.parsedouble(inputsliverhank.gettext().tostring().replaceall(",", "")); } if (index == 0) { double answer1 = 0; answer1 = (0.417 * value2 * value4 * ((100 - value1) / 100) * ((100 - value3) / 100) * value5); numberformat formatter = numberformat.getnumberinstance(); formatter.setminimumfractiondigits(2); formatter.setmaximumfractiondigits(2); answer.settext(formatter.format(answer1) + " "); } if (index == 1) { double answer2 = 0; answer2 = (((0.245 / value5) * value2 * value4 * ((100 - value1) / 100) * ((100 - value3) / 100))); numberformat formatter = numberformat.getnumberinstance(); formatter.setminimumfractiondigits(2); formatter.setmaximumfractiondigits(2); answer.settext(formatter.format(answer2) + " "); } } }); buttonformula = (button) findviewbyid(r.id.formulacombertotaldraft); buttonformula.setonclicklistener(new view.onclicklistener() { @override public void onclick(view arg0) { final dialog dialog = new dialog(context); dialog.requestwindowfeature(window.feature_no_title); dialog.setcontentview(r.layout.layout_formula); textview title = (textview) dialog.findviewbyid(r.id.title); title.settext(r.string.combertotaldraftcalculation); imageview image = (imageview) dialog.findviewbyid(r.id.test_image); image.setimageresource(r.drawable.combertotaldraftne); imageview image1 = (imageview) dialog.findviewbyid(r.id.test_image1); image1.setimageresource(r.drawable.combertotaldraftktex); textview text = (textview) dialog.findviewbyid(r.id.text); text.settext(r.string.formula_combertotaldraftcalculation); button dialogbutton = (button) dialog.findviewbyid(r.id.dialogbuttonok); dialogbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { dialog.dismiss(); } }); dialog.show(); } }); } @override public void onbackpressed() { startappad.onbackpressed(this); super.onbackpressed(); } }
xml file
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/layoutbackgroundcolor"> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_above="@+id/startappbanner" android:fillviewport="true"> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/layoutbackgroundcolor" app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:context="sujaynambiar.paid.combertotaldraftdrafting" tools:showin="@layout/activity_comber_total_draft_drafting"> <view android:id="@+id/dot" android:layout_width="fill_parent" android:layout_height="3dp" android:layout_marginbottom="@dimen/separator_textview" android:layout_margintop="@dimen/firstviewmargintop" android:background="@drawable/separator" android:layertype="software" /> <linearlayout android:id="@+id/rl1" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/dot" android:layout_marginbottom="@dimen/gap_for_all" android:orientation="horizontal" android:weightsum="3"> <textview android:id="@+id/textview14" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginend="@dimen/padding_left" android:layout_marginleft="@dimen/padding_left" android:layout_marginright="@dimen/padding_right" android:layout_marginstart="@dimen/padding_right" android:layout_weight="1.25" android:text="@string/showtext52" android:textcolor="@color/textviewtextcolor" android:textsize="@dimen/textviewsize" /> <edittext android:id="@+id/inputbatttensioncombertotaldraft" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginend="@dimen/padding_left" android:layout_marginleft="@dimen/padding_left" android:layout_marginright="@dimen/padding_right" android:layout_marginstart="@dimen/padding_right" android:layout_weight="1.75" android:ems="10" android:gravity="center" android:inputtype="numberdecimal" /> </linearlayout> <view android:id="@+id/dot1" android:layout_width="fill_parent" android:layout_height="3dp" android:layout_below="@+id/rl1" android:layout_marginbottom="@dimen/separator_textview" android:background="@drawable/separator" android:layertype="software" /> <linearlayout android:id="@+id/rl2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/dot1" android:layout_marginbottom="@dimen/gap_for_all" android:orientation="horizontal" android:weightsum="3"> <textview android:id="@+id/textview15" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginend="@dimen/padding_left" android:layout_marginleft="@dimen/padding_left" android:layout_marginright="@dimen/padding_right" android:layout_marginstart="@dimen/padding_right" android:layout_weight="1.25" android:text="@string/showtext51" android:textcolor="@color/textviewtextcolor" android:textsize="@dimen/textviewsize" /> <edittext android:id="@+id/inputbattweightcombertotaldraft" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginend="@dimen/padding_left" android:layout_marginleft="@dimen/padding_left" android:layout_marginright="@dimen/padding_right" android:layout_marginstart="@dimen/padding_right" android:layout_weight="1.75" android:ems="10" android:gravity="center" android:inputtype="numberdecimal" /> </linearlayout> <view android:id="@+id/dot2" android:layout_width="fill_parent" android:layout_height="3dp" android:layout_below="@+id/rl2" android:layout_marginbottom="@dimen/separator_textview" android:background="@drawable/separator" android:layertype="software" /> <linearlayout android:id="@+id/rl3" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/dot2" android:layout_marginbottom="@dimen/gap_for_all" android:orientation="horizontal" android:weightsum="3"> <textview android:id="@+id/textview16" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginend="@dimen/padding_left" android:layout_marginleft="@dimen/padding_left" android:layout_marginright="@dimen/padding_right" android:layout_marginstart="@dimen/padding_right" android:layout_weight="1.25" android:text="@string/showtext50" android:textcolor="@color/textviewtextcolor" android:textsize="@dimen/textviewsize" /> <edittext android:id="@+id/inputnoilbcombertotaldraft" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginend="@dimen/padding_left" android:layout_marginleft="@dimen/padding_left" android:layout_marginright="@dimen/padding_right" android:layout_marginstart="@dimen/padding_right" android:layout_weight="1.75" android:ems="10" android:gravity="center" android:inputtype="numberdecimal" /> </linearlayout> <view android:id="@+id/dot5" android:layout_width="fill_parent" android:layout_height="3dp" android:layout_below="@+id/rl3" android:layout_marginbottom="@dimen/separator_button" android:background="@drawable/separator" android:layertype="software" /> <linearlayout android:id="@+id/rl4" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/dot5" android:layout_marginbottom="@dimen/gap_for_all" android:orientation="horizontal" android:weightsum="3"> <textview android:id="@+id/textview17" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginend="@dimen/padding_left" android:layout_marginleft="@dimen/padding_left" android:layout_marginright="@dimen/padding_right" android:layout_marginstart="@dimen/padding_right" android:layout_weight="1.25" android:text="@string/showtext49" android:textcolor="@color/textviewtextcolor" android:textsize="@dimen/textviewsize" /> <edittext android:id="@+id/inputfeedamountcombertotaldraft" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginend="@dimen/padding_left" android:layout_marginleft="@dimen/padding_left" android:layout_marginright="@dimen/padding_right" android:layout_marginstart="@dimen/padding_right" android:layout_weight="1.75" android:ems="10" android:gravity="center" android:inputtype="numberdecimal" /> </linearlayout> <view android:id="@+id/dot6" android:layout_width="fill_parent" android:layout_height="3dp" android:layout_below="@+id/rl4" android:layout_marginbottom="@dimen/separator_textview" android:background="@drawable/separator" android:layertype="software" /> <textview android:id="@+id/textview18" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/dot6" android:layout_marginbottom="@dimen/textview_spinner" android:layout_marginend="@dimen/padding_left" android:layout_marginleft="@dimen/padding_left" android:layout_marginright="@dimen/padding_right" android:layout_marginstart="@dimen/padding_right" android:text="@string/showtext43" android:textcolor="@color/textviewtextcolor" android:textsize="@dimen/textviewsize" /> <textview android:id="@+id/textview11" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/textview18" android:layout_marginbottom="@dimen/textview_spinner" android:layout_marginend="@dimen/padding_left" android:layout_marginleft="@dimen/padding_left" android:layout_marginright="@dimen/padding_right" android:layout_marginstart="@dimen/padding_right" android:text="@string/showtext30a" android:textcolor="@color/textviewtextcolor" android:textsize="@dimen/textviewsize" /> <linearlayout android:id="@+id/rl5" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/textview11" android:layout_marginbottom="@dimen/gap_for_all" android:orientation="horizontal" android:weightsum="3"> <spinner android:id="@+id/spinnerselectcountunit" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginend="@dimen/padding_left" android:layout_marginleft="@dimen/padding_left" android:layout_marginright="@dimen/padding_right" android:layout_marginstart="@dimen/padding_right" android:layout_weight="1.25" android:gravity="center" android:spinnermode="dialog" /> <edittext android:id="@+id/inputsliverhankcombertotaldrfat" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_marginend="@dimen/padding_left" android:layout_marginleft="@dimen/padding_left" android:layout_marginright="@dimen/padding_right" android:layout_marginstart="@dimen/padding_right" android:layout_weight="1.75" android:ems="10" android:gravity="center" android:inputtype="numberdecimal" /> </linearlayout> <view android:id="@+id/dot7" android:layout_width="fill_parent" android:layout_height="3dp" android:layout_below="@+id/rl5" android:layout_marginbottom="@dimen/separator_button" android:background="@drawable/separator" android:layertype="software" /> <button android:id="@+id/calculatecombertotaldraft" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/dot7" android:layout_marginbottom="@dimen/button_separator" android:layout_marginend="@dimen/padding_left" android:layout_marginleft="@dimen/padding_left" android:layout_marginright="@dimen/padding_right" android:layout_marginstart="@dimen/padding_right" android:background="@drawable/button_background" android:text="@string/calculate" android:textcolor="@color/buttontextcolor" android:textsize="@dimen/buttontext" /> <view android:id="@+id/dot8" android:layout_width="fill_parent" android:layout_height="3dp" android:layout_below="@+id/calculatecombertotaldraft" android:layout_marginbottom="@dimen/separator_answer" android:background="@drawable/separator" android:layertype="software" /> <textview android:id="@+id/answercombertotaldraft" android:layout_width="match_parent" android:layout_height="@dimen/answerviewsize" android:layout_below="@+id/dot8" android:layout_marginbottom="@dimen/answerview_separator" android:layout_marginend="@dimen/padding_left" android:layout_marginleft="@dimen/padding_left" android:layout_marginright="@dimen/padding_right" android:layout_marginstart="@dimen/padding_right" android:gravity="center" android:text="@string/answer" android:textcolor="@color/textviewtextcolor" android:textsize="@dimen/answerview" /> <view android:id="@+id/dot10" android:layout_width="fill_parent" android:layout_height="3dp" android:layout_below="@+id/answercombertotaldraft" android:layout_marginbottom="@dimen/separator_button" android:background="@drawable/separator" android:layertype="software" /> <button android:id="@+id/formulacombertotaldraft" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/dot10" android:layout_marginbottom="@dimen/button_separator" android:layout_marginend="@dimen/padding_left" android:layout_marginleft="@dimen/padding_left" android:layout_marginright="@dimen/padding_right" android:layout_marginstart="@dimen/padding_right" android:background="@drawable/button_background" android:text="@string/formula" android:textcolor="@color/buttontextcolor" android:textsize="@dimen/buttontext" /> <view android:id="@+id/dot9" android:layout_width="fill_parent" android:layout_height="3dp" android:layout_below="@+id/formulacombertotaldraft" android:layout_marginbottom="@dimen/separator_textview" android:background="@drawable/separator" android:layertype="software" /> </relativelayout> </scrollview> <com.startapp.android.publish.banner.banner android:id="@+id/startappbanner" android:layout_width="wrap_content" android:layout_alignparentbottom="true" android:layout_height="wrap_content" android:layout_centerhorizontal="true"/> </relativelayout>
Comments
Post a Comment