2017-09-29 5 views
2

ユーザー登録フォームを作成するためにチュートリアルに従いました。このコードに従うことによって、別のテーブル呼び出しクライアントを作成し、他の関連するクラスを作成します。しかし、保存ボタンをクリックすると、アプリケーションが停止しました。私はこのエラーを修正するために多くを試していますが、動作しません。誰かがこの問題を見つけるのを手伝ってくれたら本当に助けてくれてありがとう。ありがとうございます複数のテーブルを持つAndroid Sqliteデータベースのデータを保存する際に問題が発生しました

これはactivity_client.xmlファイルです。

<?xml version="1.0" encoding="utf-8"?> 

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:tools="http://schemas.android.com/tools" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:id="@+id/nestedScrollView" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/colorBackground" 
     android:paddingBottom="20dp" 
     android:paddingLeft="20dp" 
     android:paddingRight="20dp" 
     android:paddingTop="20dp"> 

     <android.support.v7.widget.LinearLayoutCompat 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical"> 

      <android.support.v7.widget.AppCompatTextView 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="start" 
       android:layout_marginTop="0dp" 
       android:text="@string/subhead" 
       android:textSize="30sp" 
       android:textStyle="bold" /> 

      <!--Company Name--> 
      <android.support.design.widget.TextInputLayout 
       android:id="@+id/textInputLayoutCmpyName" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="40dp"> 

       <android.support.design.widget.TextInputEditText 
        android:id="@+id/textInputEditTextCmpyName" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/hintCmpyName" 
        android:inputType="text" 
        android:maxLines="1" 
        android:textColor="@android:color/black" /> 

      </android.support.design.widget.TextInputLayout> 

      <!--Address--> 
      <android.support.design.widget.TextInputLayout 
       android:id="@+id/textInputLayoutCmpyAddress" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="15dp"> 

       <android.support.design.widget.TextInputEditText 
        android:id="@+id/textInputEditTextAddress" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/hintCmpyAddress" 
        android:inputType="text" 
        android:maxLines="5" 
        android:textColor="@android:color/black" /> 

       </android.support.design.widget.TextInputLayout> 

      <!--Mobile--> 
      <android.support.design.widget.TextInputLayout 
       android:id="@+id/textInputLayoutCmpyMobile" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="15dp"> 

       <android.support.design.widget.TextInputEditText 
        android:id="@+id/textInputEditTextMobile" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/hintClientMobile" 
        android:inputType="text" 
        android:maxLines="5" 
        android:textColor="@android:color/black" /> 

      </android.support.design.widget.TextInputLayout> 

     <!--Email--> 

     <android.support.design.widget.TextInputLayout 
      android:id="@+id/textInputLayoutCmpyEmail" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="15dp"> 

      <android.support.design.widget.TextInputEditText 
       android:id="@+id/textInputEditTextEmail" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:hint="@string/hintClientEmail" 
       android:inputType="text" 
       android:maxLines="5" 
       android:textColor="@android:color/black" /> 

     </android.support.design.widget.TextInputLayout> 

     </android.support.v7.widget.LinearLayoutCompat> 

     <android.support.v7.widget.AppCompatButton 
      android:id="@+id/appCompatButtonBack" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:layout_alignParentEnd="true" 
      android:layout_alignParentRight="true" 
      android:layout_gravity="right" 
      android:layout_marginBottom="357dp" 
      android:layout_marginEnd="36dp" 
      android:layout_marginRight="36dp" 
      android:background="@color/colorTextHint" 
      android:text="@string/text_back" /> 

<!--save button-->  
<android.support.v7.widget.AppCompatButton 
      android:id="@+id/appCompatButtonSave" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignBaseline="@+id/appCompatButtonBack" 


       android:layout_alignBottom="@+id/appCompatButtonBack" 
       android:layout_alignParentLeft="true" 
       android:layout_alignParentStart="true" 
       android:layout_marginLeft="38dp" 
       android:layout_marginStart="38dp" 
       android:background="@color/colorTextHint" 
       android:text="@string/text_save" /> 

     </RelativeLayout> 

DataBaseHelper class in an package call dbclasses. Yhis class has code for both ClentInfo class and UserRegister class;another class. 

パブリッククラスDataBaseHelperはSQLiteOpenHelper {

//Database version 
    private static final int DATABASE_VERSION = 1; 

    // Database Name 
    private static final String DATABASE_NAME = "Database1.db"; 

    //table names 
    private static final String TABLE_USER = "user"; // User table name 
    private static final String TABLE_CLIENT = "client"; 

//Client Table Columns names 
    private static final String COLUMN_CLIENT_ID = "client_id"; 
    private static final String COLUMN_CLIENT_NAME = "client_name"; 
    private static final String COLUMN_CLIENT_ADDRESS = "client_address"; 
    private static final String COLUMN_CLIENT_MOBILE = "client_mobile"; 
    private static final String COLUMN_CLIENT_EMAIL = "client_email"; 


    //create client table 
    private String CREATE_CLIENT_TABLE = "CREATE TABLE " + TABLE_CLIENT + "(" 
      + COLUMN_CLIENT_ID + " INTEGER PRIMARY KEY AUTOINCREMENT," 
      + COLUMN_CLIENT_NAME + " TEXT," 
      + COLUMN_CLIENT_ADDRESS + " TEXT," 
      + COLUMN_CLIENT_MOBILE + " TEXT," 
      + COLUMN_CLIENT_EMAIL + " TEXT" 
      + ")"; 

    // drop table sql query 
    private String DROP_USER_TABLE = "DROP TABLE IF EXISTS " + TABLE_USER; //for user table 
    private String DROP_CLIENT_TABLE = "DROP TABLE IF EXISTS " + TABLE_CLIENT; 


public DataBaseHelper(Context context) { 
    super(context, DATABASE_NAME, null, DATABASE_VERSION); 
} 

@Override 
public void onCreate(SQLiteDatabase db) { 
    db.execSQL(CREATE_USER_TABLE); 
    db.execSQL(CREATE_CLIENT_TABLE); 
} 

@Override 
public void onUpgrade(SQLiteDatabase db, int i, int i1) { 
    db.execSQL(DROP_USER_TABLE); 
    db.execSQL(DROP_CLIENT_TABLE); 



    //create new tables 


      onCreate(db); 
     } 

    //---------------------------client table methods-------------------- 
    //add user 
     public void addClient(Client client) { 

     SQLiteDatabase db = this.getWritableDatabase(); 

     ContentValues values = new ContentValues(); 
     values.put(COLUMN_CLIENT_NAME, client.getCmpyName()); 
     values.put(COLUMN_CLIENT_ADDRESS, client.getAddress()); 
     values.put(COLUMN_CLIENT_MOBILE, client.getMobile()); 
     values.put(COLUMN_USER_EMAIL, client.getEmail()); 

     //Inserting Row 
     db.insert(TABLE_CLIENT, null, values); 
     db.close(); 
    } 


    //get all clients 
    public List<Client> getAllClients() { 
     String columns1[] = { 
       COLUMN_CLIENT_ID, 
       COLUMN_CLIENT_NAME, 
       COLUMN_CLIENT_ADDRESS, 
       COLUMN_CLIENT_MOBILE, 
       COLUMN_USER_EMAIL 
     }; 

     //sorting orders 
     String sortOrder = COLUMN_CLIENT_NAME + " ASC"; 
     List<Client> clientList = new ArrayList<Client>(); 

     SQLiteDatabase db = this.getReadableDatabase(); 

     Cursor cursor = db.query(TABLE_CLIENT, 
       columns1, 
       null, 
       null, 
       null, 
       null, 
       sortOrder); 

     if (cursor.moveToFirst()) { 
      do { 
       Client client = new Client(); 
       client.setCid(Integer.parseInt(cursor.getString(cursor.getColumnIndex(COLUMN_CLIENT_ID)))); 
       client.setCmpyName(cursor.getString(cursor.getColumnIndex(COLUMN_CLIENT_NAME))); 
       client.setAddress(cursor.getString(cursor.getColumnIndex(COLUMN_CLIENT_ADDRESS))); 
       client.setMobile(cursor.getString(cursor.getColumnIndex(COLUMN_CLIENT_MOBILE))); 
       client.setEmail(cursor.getString(cursor.getColumnIndex(COLUMN_CLIENT_EMAIL))); 

       //adding clients to list 
       clientList.add(client); 
      } while (cursor.moveToNext()); 
     } 
     cursor.close(); 
     db.close(); 

     return clientList; 
    } 

//update the clients 
    public void updateClient(Client client) { 
     SQLiteDatabase db = this.getWritableDatabase(); 

     ContentValues values = new ContentValues(); 
     values.put(COLUMN_CLIENT_NAME, client.getCmpyName()); 
     values.put(COLUMN_CLIENT_ADDRESS, client.getAddress()); 
     values.put(COLUMN_CLIENT_MOBILE, client.getMobile()); 
     values.put(COLUMN_USER_EMAIL, client.getEmail()); 

     //updating row 
     db.update(TABLE_CLIENT, values, COLUMN_CLIENT_ID + " = ?", 
       new String[]{ 
         String.valueOf(client.getCid()) 
       }); 

     db.close(); 
    } 

    public boolean checkClient(String cmpyName) { 
     String[] columns = { 
       COLUMN_CLIENT_ID 
     }; 
     SQLiteDatabase db = this.getReadableDatabase(); 

     String selection = COLUMN_CLIENT_NAME + " = ?"; 

     // selection argument 
     String[] selectionArgs = {cmpyName}; 
     Cursor cursor = db.query(TABLE_CLIENT, //Table to query 
       columns,     //columns to return 
       selection,     //columns for the WHERE clause 
       selectionArgs,    //The values for the WHERE clause 
       null,      //group the rows 
       null,      //filter by row groups 
       null);      //The sort order 
     int cursorCount = cursor.getCount(); 
     cursor.close(); 
     db.close(); 

     if (cursorCount > 0) { 
      return true; 
     } 
     return false; 
    } 

} 

これはClientActivityクラスでクライアントパッケージに

package com.example.user.application001.Client; 

    import android.support.design.widget.Snackbar; 
    import android.support.design.widget.TextInputEditText; 
    import android.support.design.widget.TextInputLayout; 
    import android.support.v4.widget.NestedScrollView; 
    import android.support.v7.app.AppCompatActivity; 
    import android.os.Bundle; 
    import android.support.v7.widget.AppCompatButton; 
    import android.view.View; 
    import android.widget.Toast; 

    import com.example.user.application001.R; 

    import dbclasses.DataBaseHelper; 
    import modelclasses.Client; 

    public class ClientActivity extends AppCompatActivity implements View.OnClickListener { 

     private final AppCompatActivity activity = ClientActivity.this; 

     private DataBaseHelper dbHelper; 
     private ClientValidation clientValidation; 

     private Client client; 


     //private NestedScrollView nestedScrollView; 
     private TextInputLayout textInputLayoutCmpyName, textInputLayoutCmpyAddress, textInputLayoutCmpyMobile, textInputLayoutCmpyEmail; 
     private TextInputEditText textInputEditTextCmpyName, textInputEditTextAddress, textInputEditTextMobile, textInputEditTextEmail; 
     private AppCompatButton appCompatButtonSave, appCompatButtonBack; 


     @Override 
     protected void onCreate(Bundle savedInstanceState) { 
      super.onCreate(savedInstanceState); 
      setContentView(R.layout.activity_client); 

      setTitle("Customer Information"); 

      initViews(); 
      initListeners(); 
      initObjects(); 

     } 

     public void initViews() { 

      //nestedScrollView = (NestedScrollView) findViewById(R.id.nestedScrollView); 
      textInputLayoutCmpyName = (TextInputLayout) findViewById(R.id.textInputLayoutCmpyName); 
      textInputLayoutCmpyAddress = (TextInputLayout) findViewById(R.id.textInputLayoutCmpyAddress); 
      textInputLayoutCmpyMobile = (TextInputLayout) findViewById(R.id.textInputLayoutCmpyMobile); 
      textInputLayoutCmpyEmail = (TextInputLayout) findViewById(R.id.textInputLayoutCmpyEmail); 

      textInputEditTextCmpyName = (TextInputEditText) findViewById(R.id.textInputEditTextCmpyName); 
      textInputEditTextAddress = (TextInputEditText) findViewById(R.id.textInputEditTextAddress); 
      textInputEditTextMobile = (TextInputEditText) findViewById(R.id.textInputEditTextMobile); 
      textInputEditTextEmail = (TextInputEditText) findViewById(R.id.textInputEditTextEmail); 

      appCompatButtonSave = (AppCompatButton) findViewById(R.id.appCompatButtonSave); 
      appCompatButtonBack = (AppCompatButton) findViewById(R.id.appCompatButtonBack); 

     } 

     public void initListeners() { 
      appCompatButtonBack.setOnClickListener(this); 
      appCompatButtonSave.setOnClickListener(this); 
     } 

     public void initObjects() { 

      clientValidation = new ClientValidation(activity); 
      dbHelper = new DataBaseHelper(activity); 

      client = new Client(); 
     } 

     @Override 
     public void onClick(View v) { 
      switch (v.getId()){ 
       case R.id.appCompatButtonSave: 
        savetoSQliteDb(); 
        break; 
       case R.id.appCompatButtonBack: 
        break; 
      } 
     } 

     private void savetoSQliteDb(){ 

      if (!clientValidation.isInputEditTextFilled(textInputEditTextCmpyName, textInputLayoutCmpyName, getString(R.string.errorCmpyName))){ 
       return; 
      } 
      if (!clientValidation.isInputEditTextFilled(textInputEditTextAddress, textInputLayoutCmpyAddress, getString(R.string.errorCmpyAddress))){ 
       return; 
      } 
      if (!clientValidation.isInputEditTextFilled(textInputEditTextMobile, textInputLayoutCmpyMobile, getString(R.string.errorCustomerMobile))){ 
       return; 
      }if (!clientValidation.isInputEditTextFilled(textInputEditTextEmail, textInputLayoutCmpyEmail, getString(R.string.errorCustomerEmail))){ 
       return; 
      } 

      if (!dbHelper.checkClient(textInputEditTextCmpyName.getText().toString())){ 
       client.setCmpyName(textInputEditTextCmpyName.getText().toString().trim()); 
       client.setAddress(textInputEditTextAddress.getText().toString().trim()); 
       client.setMobile(textInputEditTextMobile.getText().toString().trim()); 
       client.setEmail(textInputEditTextEmail.getText().toString().trim()); 

       //add one record 
       dbHelper.addClient(client); 
       emptyInputEditText(); 

       // Toast.makeText(getApplicationContext(), "Data Entered", Toast.LENGTH_LONG).show(); 

      } 

     } 

     private void emptyInputEditText() { 
      textInputEditTextCmpyName.setText(null); 
      textInputEditTextAddress.setText(null); 
      textInputEditTextMobile.setText(null); 
      textInputEditTextEmail.setText(null); 
     } 

    } 

This is the ClientValidation Java class. This is also in the client package 



    package com.example.user.application001.Client; 

     import android.app.Activity; 
     import android.content.Context; 
     import android.support.design.widget.TextInputEditText; 
     import android.support.design.widget.TextInputLayout; 
     import android.view.View; 
     import android.view.WindowManager; 
     import android.view.inputmethod.InputMethodManager; 

     /** 
     * Created by User on 9/28/2017. 
     */ 

     public class ClientValidation { 

      private Context context; 

      public ClientValidation(Context context) { 
       this.context = context; 
      } 

      public boolean isInputEditTextFilled(TextInputEditText textInputEditText, TextInputLayout textInputLayout, String message) { 
       String value = textInputEditText.getText().toString().trim(); 
       if (value.isEmpty()) { 
        textInputLayout.setError(message); 
        hideKeyboardFrom(textInputEditText); 
        return false; 
       } else { 
        textInputLayout.setErrorEnabled(false); 
       } 
       return true; 
      } 
      private void hideKeyboardFrom(View view) { 

       InputMethodManager imm = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE); 
       imm.hideSoftInputFromWindow(view.getWindowToken(), WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 

      } 

     } 

    This is the Client class. It is in modelclasses package. 

    package modelclasses; 

    /** 
    * Created by User on 9/26/2017. 
    */ 

    public class Client { 

     private int cid; 
     private String cmpyName; 
     private String address; 
     private String mobile; 
     private String email; 

     public int getCid() { 
      return cid; 
     } 

     public void setCid(int cid) { 
      this.cid = cid; 
     } 

     public String getCmpyName() { 
      return cmpyName; 
     } 

     public void setCmpyName(String cmpyName) { 
      this.cmpyName = cmpyName; 
     } 

     public String getAddress() { 
      return address; 
     } 

     public void setAddress(String address) { 
      this.address = address; 
     } 

     public String getMobile() { 
      return mobile; 
     } 

     public void setMobile(String mobile) { 
      this.mobile = mobile; 
     } 

     public String getEmail() { 
      return email; 
     } 

     public void setEmail(String email) { 
      this.email = email; 
     } 

    } 

logcat

/split_lib_slice_3_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status 
    09-29 08:29:01.252 4993-4993/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.user.application001-2/split_lib_slice_4_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status 
    09-29 08:29:01.264 4993-4993/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.user.application001-2/split_lib_slice_5_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status 
    09-29 08:29:01.276 4993-4993/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.user.application001-2/split_lib_slice_6_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status 
    09-29 08:29:01.290 4993-4993/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.user.application001-2/split_lib_slice_7_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected][email protected]@[email protected]) because non-0 exit status 
    09-29 08:29:01.305 4993-4993/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.user.application001-2/split_lib_slice_8_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status 
    09-29 08:29:01.317 4993-4993/? W/art: Failed execv(/system/bin/dex2oat --runtime-arg -classpath --runtime-arg --debuggable --instruction-set=x86 --instruction-set-features=smp,ssse3,-sse4.1,-sse4.2,-avx,-avx2 --runtime-arg -Xrelocate --boot-image=/system/framework/boot.art --runtime-arg -Xms64m --runtime-arg -Xmx512m --instruction-set-variant=x86 --instruction-set-features=default --dex-file=/data/app/com.example.user.application001-2/split_lib_slice_9_apk.apk --oat-file=/data/dalvik-cache/x86/[email protected]@[email protected][email protected]) because non-0 exit status 
    09-29 08:29:01.318 4993-4993/? W/System: ClassLoader referenced unknown path: /data/app/com.example.user.application001-2/lib/x86 
    09-29 08:29:01.320 4993-4993/? I/InstantRun: starting instant run server: is main process 
    09-29 08:29:01.384 4993-4993/? W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 
    09-29 08:29:01.495 4993-5038/? D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true 

                [ 09-29 08:29:01.497 4993: 4993 D/   ] 
                HostConnection::get() New Host Connection established 0xa4187280, tid 4993 


                [ 09-29 08:29:01.498 4993: 4993 W/   ] 
                Unrecognized GLES max version string in extensions: ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 

                [ 09-29 08:29:01.523 4993: 5038 D/   ] 
                HostConnection::get() New Host Connection established 0xaaffbd40, tid 5038 


                [ 09-29 08:29:01.524 4993: 5038 W/   ] 
                Unrecognized GLES max version string in extensions: ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_dma_v1 
    09-29 08:29:01.526 4993-5038/? I/OpenGLRenderer: Initialized EGL, version 1.4 
    09-29 08:29:01.526 4993-5038/? W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... 
    09-29 08:29:01.534 4993-5038/? D/EGL_emulation: eglCreateContext: 0xaf0635a0: maj 2 min 0 rcv 2 
    09-29 08:29:01.535 4993-5038/? D/EGL_emulation: eglMakeCurrent: 0xaf0635a0: ver 2 0 (tinfo 0xaf0528e0) 
    09-29 08:29:01.554 4993-5038/? D/EGL_emulation: eglMakeCurrent: 0xaf0635a0: ver 2 0 (tinfo 0xaf0528e0) 
    09-29 08:29:01.610 4993-4993/? W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView 
+0

あなたは私たちがあなたを助けることができるようにするための正確なエラーメッセージを見てする必要があります。 Androidスタジオでは、通常、下部のデバッグ/実行タブ、またはASウィンドウの下部にあるlogcatビューで利用できます。通常、赤色の最初の数行が最も有用なものになり、ファイル名のペア+行番号が続き、問題がどこにあるのかを見つけることができます。 – Fabio

+0

@Fabio、データの保存に関する私のlogcatのエラーを見つけることができません – Kash

答えて

0

がインスタント実行UNTを無効にしてみてくださいを拡張しますあなたはAndroidに慣れていますが、この特定の問題は、最新の安定したビルド(2.3.3)で安定していないインスタント実行から来ているようです:

つまり、Androidスタジオの設定を開いて、検索ボックスを無効にして無効にします。

この質問はそれを行う方法を説明します。Instant run in Android Studio 2.0 (how to turn off)

+0

残念ながら、私の問題は解決しません。 – Kash

+0

あなたはエラーがあると言うときに具体的にする必要があります。それはクラッシュしますか?それは凍結ですか?何もしませんか?そのように見えるときにデータを保存しませんか?推測作業をすることは不可能です。 – Fabio

+0

@Fa bio、保存ボタンをクリックすると「アプリケーションが停止しました」と表示されます。そして、私は先に進むことができず、アプリは動作を停止します – Kash

関連する問題