android application using java -


morning dear freinds, i'm new in android , have problem button,when click on program closed message 09-14 12:39:30.197 10756-10756/com.mugenziisrael.bus_booking e/androidruntime: fatal exception: main

java.lang.runtimeexception: unable start activity componentinfo{com.mugenziisrael.bus_booking/com.delaroystudios.bus_seat_booking_system.sign_in}:  android.view.inflateexception: binary xml file line #71: error inflating class button 

please know may me solve issue, main class.

package com.delaroystudios.bus_seat_booking_system; import android.content.intent; import android.graphics.color; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.button; import android.widget.spinner; import android.widget.spinneradapter; import android.widget.textview; import android.widget.toast;  public class main_activity_login extends appcompatactivity {      @override     protected void oncreate(bundle savedinstancestate){         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main_login);         button login;         button sign;          login = (button)findviewbyid(r.id.log);         spinner spinner = (spinner)findviewbyid(r.id.spinner1);          sign = (button)findviewbyid(r.id.signin);          arrayadapter<charsequence> adapter = arrayadapter.createfromresource(this,r.array.roles_selection,android.r.layout.simple_spinner_item);         adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item);        spinner.setadapter(adapter);         spinner.setonitemselectedlistener(new adapterview.onitemselectedlistener() {             @override             public void onitemselected(adapterview<?> parent, view view, int position, long l) {                 toast.maketext(getbasecontext(),parent.getitematposition(position)+ "selected",toast.length_long).show();                 ((textview) parent.getchildat(0)).settextcolor(color.red);//to change color of spinner items             }             @override             public void onnothingselected(adapterview<?> parent){              }         });          sign.setonclicklistener(                 new view.onclicklistener(){                     @override                     public void onclick(view v){                         intent intent = new intent(v.getcontext(),sign_in.class);                         v.getcontext().startactivity(intent);                     }                 }         );         login.setonclicklistener(                 new view.onclicklistener(){                     @override                     public void onclick(view v){                         intent intent = new intent(v.getcontext(),detailslogin.class);                         v.getcontext().startactivity(intent);                     }                 }         );      }     } 

the xml file :

     <?xml version="1.0" encoding="utf-8"?> <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="match_parent"     android:orientation="horizontal"     tools:context="com.delaroystudios.bus_seat_booking_system.main_activity_login" android:background="@drawable/bus1"     >      <linearlayout         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:orientation="horizontal"         android:id="@+id/menu1"         android:layout_marginbottom="100dp"         android:layout_margintop="20dp"         android:gravity="center"         android:layout_marginstart="30dp"         >         <button             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="@string/home"             android:textsize="20sp"             android:textcolor="#9b59b6"             />          <button             android:id="@+id/textview2"             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="@string/about"             android:textcolor="#9b59b6"             android:textsize="20sp" />          <button             android:layout_width="wrap_content"             android:layout_height="wrap_content"             android:text="@string/contact"             android:textsize="20sp"             android:textcolor="#9b59b6"             />        <!--a verifier -->      </linearlayout>      <linearlayout         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:orientation="horizontal"         android:layout_below="@+id/menu1"         android:id="@+id/menu2"         android:layout_marginbottom="30dp"         >   <textview       android:layout_width="150dp"       android:layout_height="wrap_content"       android:text="@string/login2"       android:textsize="28sp" android:textcolor="#9b59b6"       />          <edittext             android:id="@+id/editlog"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:hint="@string/login"             android:textcolorhint="#9b59b6"             android:textcolor="#ffff"             />     </linearlayout>     <linearlayout         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:orientation="horizontal"         android:layout_below="@+id/menu2"         android:id="@+id/menu3"         android:layout_marginbottom="30dp"         >          <textview             android:id="@+id/textview"             android:layout_width="150dp"             android:layout_height="wrap_content"             android:text="@string/pass"             android:textsize="28sp"             android:textcolor="#9b59b6"             />          <edittext             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:hint="@string/your_password"             android:id="@+id/edit_menu2"             android:textcolorhint="#9b59b6"             android:textcolor="#ffff"             />     </linearlayout>     <linearlayout         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:orientation="horizontal"         android:layout_below="@+id/menu3"         android:layout_marginbottom="10dp"         android:id="@+id/role"         >         <textview             android:id="@+id/t_role"             android:layout_width="150dp"             android:layout_height="wrap_content"             android:text="@string/role"             android:textsize="28sp"             android:textcolor="#9b59b6"             /> <spinner     android:layout_width="fill_parent"     android:layout_height="wrap_content"     android:id="@+id/spinner1"      />     </linearlayout>     <linearlayout         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:orientation="horizontal"         android:id="@+id/men1"         android:layout_margintop="70dp"         android:layout_below="@+id/role"         android:gravity="center"         android:layout_marginstart="30dp"         >          <button             android:id="@+id/log"             android:layout_width="150dp"             android:layout_height="wrap_content"             android:layout_marginend="30dp"             android:onclick="onclick"             android:text="@string/login"             android:textcolor="#9b59b6"             android:textcolorhint="#9b59b6"             android:textsize="20sp"              />        <button               android:id="@+id/signin"               android:layout_width="150dp"               android:layout_height="wrap_content"               android:layout_marginend="30dp"             android:onclick="onclick"             android:text="@string/sign_in"             android:textcolor="#9b59b6"             android:textcolorhint="#9b59b6"             android:textsize="20sp" />    </linearlayout> </relativelayout> 

try this.

intent intent = new intent(//class activity ,give activity name want go); startactivity(intent); 

same second button


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -