mercredi 23 avril 2014

Problems with appearance in XML Android: "The following classes could not be instantiated:"


Vote count:

0




My xml file has this error, please help.


this is the error info:



The following classes could not be instantiated: - cours.bob.mediaplayer.TouchInterceptor (Open Class, Show Error Log) See the Error Log (Window > Show View) for more details. Tip: Use View.isInEditMode() in your custom views to skip code when shown in Eclipse


Blockquote java.lang.NullPointerException at cours.bob.mediaplayer.TouchInterceptor.(TouchInterceptor.java:81) at sun.reflect.NativeConstructorAccessorImpl.newInstance0( at sun.reflect.NativeConstructorAccessorImpl.newInstance( at sun.reflect.DelegatingConstructorAccessorImpl.newInstance( at java.lang.reflect.Constructor.newInstance( at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.instantiateClass(ProjectCallback.java:422) at com.android.ide.eclipse.adt.internal.editors.layout.ProjectCallback.loadView(ProjectCallback.java:179) at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207) at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:135) at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:755) at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64) at android.view.LayoutInflater.rInflate(LayoutInflater.java:727) at android.view.LayoutInflater.inflate(LayoutInflater.java:492) at android.view.LayoutInflater.inflate(LayoutInflater.java:373)



Here is the constructor source code for class TouchInterceptor



public TouchInterceptor(Context context, AttributeSet attrs) {
super(context, attrs);
SharedPreferences pref = context.getSharedPreferences("Music", 3);
**mRemoveMode = pref.getInt("deletemode", -1);**
mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
Resources res = getResources();
mItemHeightNormal = res.getDimensionPixelSize(R.dimen.normal_height);
mItemHeightHalf = mItemHeightNormal / 2;
mItemHeightExpanded = res.getDimensionPixelSize(R.dimen.expanded_height);
}


line 81 is the code: mRemoveMode = pref.getInt("deletemode", -1);



asked 56 secs ago






Aucun commentaire:

Enregistrer un commentaire