Common android development error handling scheme:

Database aspect:
SQL > create database; String SQL ="create table jsbContent (id INTEGER primary key autoincrement, jsbtitle varchar(256),jsbcontent varchar(256))"; ExecSQL ("update user set username=? , password=? where id=?" ,new Object[]{user.getUsername(),user.getPassword(),user.getId()}); Near "where": syntax error (code 1): syntax error; SQLiteDatabase db=helper.getWritableDatabase(); Service =new JdbService(this.getContext()));Copy the code

** R file loss error reported

~ recompile first, possible system problem ~ 1. Introduced wrong package name (delete) 2. Drawable images are named incorrectly. They cannot have improper names such as numbers and uppercase letters, and can only have a suffix of ". R file has not been loaded, import R file package as prompted. 4. 5. If the program flashes back, it is abnormal at runtime, see the log to modify 6. If you cannot find the control whose ID has been added, you may not have automatically imported the current R packageCopy the code

7. Customize the spacing between items. The total height of the entire layout file should be set manually according to the actual situation, not match_parent, otherwise the distance between two items will be very large

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:orientation="vertical" android:layout_width="match_parent"
                android:layout_height="80dp"
Copy the code
8, from the acvitity value jump to the Fragment data display is not synchronized, in the onStart method received through the value, can be synchronized display, in the onCreate method can only restart the program to update the data, In the life cycle of acvitity, execute onRestart after onstop and then execute onStart directly, which does not execute oncreat, that is, onCreate only executes the code once when the program starts:  @Override public void onStart() { super.onStart(); intiView(); } public void intiView(){// Set layout loader rv_frgjsb.setLayOutManager (new LinearLayoutManager(this.getContext())); service=new JdbService(this.getContext()); list =service.quaryAll(); adapter=new FrgJsbAdapter(this.getContext(),list); rv_frgjsb.setAdapter(adapter); title_addimg.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent=new Intent(getContext(),JsbAddActivity.class); startActivity(intent); JsbFragment.super.getActivity().finish(); }});Copy the code

GetSerializableExtra (” item “) returns a null value and cannot be executed.

Intent intent=getIntent(); if(intent.getSerializableExtra("item")! =null){ JsbMiddle middle= (JsbMiddle) intent.getSerializableExtra("item"); If (AIDL) is null, then use the corresponding entity class to receive the service null pointer: <service Android :name=".musicService "Android :enabled="true" Android :exported="true"> <intent-filter> <action android:name="com.work.MusicService"></action> </intent-filter> </service>Copy the code

AppCompatActivityThe red line:

No import v7 package import android. Support. V7. App. AppCompatActivity;