android - InflateException While creating dialog box -


i got infalte exception during code

public view oncreateview(layoutinflater inflater, viewgroup container,     bundle savedinstancestate) { appcontext=getactivity().getapplicationcontext(); mycontext=getactivity(); }  private void createalertbox(final appointmentrow appointmentrow) { final dialog dialog = new dialog(mycontext, r.style.dialog); view layout = layoutinflater.from(appcontext).inflate(r.layout.custom_autocomplete, null); string[] from={"id","name"}; ..................... ..................... } 

exception occured in following line.

view layout = layoutinflater.from(appcontext).inflate(r.layout.custom_autocomplete, null); 

exception android.view.inflateexception. there solution?

    <com.example.netmdapp1.customviews.customautocompletetextview     android:id="@+id/customautocomplete"     android:layout_width="250dp"     android:layout_height="wrap_content"     android:completionthreshold="1"     android:ems="10"     android:hint="patient name"     android:scrollbars="vertical"     android:textcolor="@android:color/black"     android:layout_marginleft="20dp"     android:layout_marginright="20dp"     android:background="@drawable/edittext_modified_states"     android:layout_margintop="5dp">     <requestfocus /> </com.example.netmdapp1.customviews.customautocompletetextview> </linearlayout> </linearlayout> 

this xml part.any idea?

change code line

view layout = layoutinflater.from(appcontext).inflate(r.layout.custom_autocomplete, null);                        view layout = view.inflate(getapplicationcontext(), r.layout.custom_autocomplete, null);                       or  layoutinflater inflater = (layoutinflater) getsystemservice(context.layout_inflater_service); view layout = inflater.inflate(r.layout.custom_autocomplete, null); 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -