android 第一次做自定义控件 java.lang.RuntimeException异常

package com.example.q9722.biancheng;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.TextView;

/**

  • Created by q9722 on 2018/1/1. */

public class test_text extends TextView {
private String mText = "111",mNumber = "222";
private Paint mPaint;
private Rect mNumberRect;

public test_text(Context context, String mText, String mNumber) {
    this(context, null, mText, mNumber);
}

public test_text(Context context, AttributeSet attrs, String mText, String mNumber) {
    this(context, attrs, 0, mText, mNumber);
}

public test_text(Context context, AttributeSet attrs, int defStyleAttr, String mText, String mNumber) {
    super(context, attrs, defStyleAttr);
    this.mText = mText;
    this.mNumber = mNumber;
    init();
}

private void init() {
    mPaint = new Paint();
}

@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    mPaint.setColor(Color.BLACK);
    mPaint.setStyle(Paint.Style.STROKE);
    canvas.drawRect(0, 0, getWidth(), getHeight(), mPaint);
    canvas.drawCircle(getWidth()/6*4, getHeight()/4*3,getHeight()/4,mPaint);
    mPaint.setTextSize(18);
    mPaint.getTextBounds(mNumber, 0, mNumber.length(), mNumberRect);
    canvas.drawText(mText, 2 ,getHeight()/5,mPaint);
    canvas.drawText(mNumber, (getWidth()/6*4)-(mNumberRect.width()/2), (getHeight()/4*3)-(mNumberRect.hashCode()/2), mPaint);
}

}

01/01 18:58:49: Launching app
$ adb push C:\Users\q9722\AndroidStudioProjects\BianCheng\app\build\outputs\apk\app-debug.apk /data/local/tmp/com.example.q9722.biancheng
$ adb shell pm install -r "/data/local/tmp/com.example.q9722.biancheng"
Success

$ adb shell am start -n "com.example.q9722.biancheng/com.example.q9722.biancheng.SplashActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Client not ready yet..Waiting for process to come online
Connected to process 30129 on device xiaomi-mi_5-43ac216f
W/System: ClassLoader referenced unknown path: /data/app/com.example.q9722.biancheng-1/lib/arm64
I/InstantRun: Instant Run Runtime started. Android package is com.example.q9722.biancheng, real application class is null.
W/System: ClassLoader referenced unknown path: /data/app/com.example.q9722.biancheng-1/lib/arm64
W/MIUI-BLOCK-MONITOR: The msg { when=-72ms what=110 obj=AppBindData{appInfo=ApplicationInfo{7c1e14a com.example.q9722.biancheng}} target=android.app.ActivityThread$H planTime=1514804333143 dispatchTime=1514804333215 finishTime=0 } took 3826ms and took 3754ms after dispatch.
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
W/System: ClassLoader referenced unknown path: /system/app/MiuiContentCatcher/lib/arm64
D/AccessibilityManager: current package=com.example.q9722.biancheng, accessibility manager mIsFinalEnabled=false, mOptimizeEnabled=true, mIsUiAutomationEnabled=false, mIsInterestedPackage=false
V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@717395
V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@bc3ccaa
V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@664d14e
D/ActivityThreadInjector: clearCachedDrawables.
I/Adreno: QUALCOMM build : 620c068, I09d312ff84
Build Date : 08/07/17
OpenGL ES Shader Compiler Version: XE031.09.00.04
Local Branch :
Remote Branch :
Remote Branch :
Reconstruct Branch :
I/Choreographer: Skipped 33 frames! The application may be doing too much work on its main thread.
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 1
V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@c8e9e47
I/Timeline: Timeline: Activity_launch_request time:84494803
V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@cd359d1
V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@4011c36
D/AndroidRuntime: Shutting down VM
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.q9722.biancheng, PID: 30129
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.q9722.biancheng/com.example.q9722.biancheng.MainActivity}: android.view.InflateException: Binary XML file line #15: Binary XML file line #15: Error inflating class com.example.q9722.biancheng.test_text
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2724)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2785)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1532)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6321)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
Caused by: android.view.InflateException: Binary XML file line #15: Binary XML file line #15: Error inflating class com.example.q9722.biancheng.test_text
Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class com.example.q9722.biancheng.test_text
Caused by: java.lang.NoSuchMethodException: [class android.content.Context, interface android.util.AttributeSet]
at java.lang.Class.getConstructor0(Class.java:2204)
at java.lang.Class.getConstructor(Class.java:1683)
at android.view.LayoutInflater.createView(LayoutInflater.java:622)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:812)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:752)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:883)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
at android.view.LayoutInflater.inflate(LayoutInflater.java:522)
at android.view.LayoutInflater.inflate(LayoutInflater.java:430)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)
at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
at com.example.q9722.biancheng.MainActivity.onCreate(MainActivity.java:17)
at android.app.Activity.performCreate(Activity.java:6847)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2785)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1532)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:163)
at android.app.ActivityThread.main(ActivityThread.java:6321)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)
Application terminated.

10个回答

把这些构造函数都加进去就不会报异常了

public test_text(Context context) {
    super(context);
}

public test_text(Context context, AttributeSet attrs) {
    super(context,attrs);
}

public test_text(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context,attrs,defStyleAttr);
}

楼主的错误应该是出现在第102行空指针错误

楼主这是要自定义TextView,还是要。。。。。。。

测试一下get有没有get到东西,如果没有get到你又set就报错。log一下

楼上说的很对,先找个例子对着敲代码吧

构造函数有问题,几个构造函数参数不要随便改,学自定义View推荐看一看hongyang大神的博客。

这个问题很简单,你在Activity的XML中引用了这个自定义类,而引用这个自定义类的全路径名称不对,在你XML的第15行

把所有的构造函数加上就行了

构造函数问题,因为放在XML里面调用,默认的构造函数还是需要的

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
android 第一次做自定义控件 java.lang.RuntimeException异常
package com.example.q9722.biancheng;nnimport android.content.Context;nimport android.graphics.Canvas;nimport android.graphics.Color;nimport android.graphics.Paint;nimport android.graphics.Rect;nimport android.util.AttributeSet;nimport android.widget.TextView;nn/**n * Created by q9722 on 2018/1/1.n */nnpublic class test_text extends TextView n private String mText = "111",mNumber = "222";n private Paint mPaint;n private Rect mNumberRect;nn public test_text(Context context, String mText, String mNumber) n this(context, null, mText, mNumber);n nn public test_text(Context context, AttributeSet attrs, String mText, String mNumber) n this(context, attrs, 0, mText, mNumber);n nn public test_text(Context context, AttributeSet attrs, int defStyleAttr, String mText, String mNumber) n super(context, attrs, defStyleAttr);n this.mText = mText;n this.mNumber = mNumber;n init();n nn private void init() n mPaint = new Paint();n nn @Overriden protected void onDraw(Canvas canvas) n super.onDraw(canvas);n mPaint.setColor(Color.BLACK);n mPaint.setStyle(Paint.Style.STROKE);n canvas.drawRect(0, 0, getWidth(), getHeight(), mPaint);n canvas.drawCircle(getWidth()/6*4, getHeight()/4*3,getHeight()/4,mPaint);n mPaint.setTextSize(18);n mPaint.getTextBounds(mNumber, 0, mNumber.length(), mNumberRect);n canvas.drawText(mText, 2 ,getHeight()/5,mPaint);n canvas.drawText(mNumber, (getWidth()/6*4)-(mNumberRect.width()/2), (getHeight()/4*3)-(mNumberRect.hashCode()/2), mPaint);n nnnnnn01/01 18:58:49: Launching appn$ adb push C:\Users\q9722\AndroidStudioProjects\BianCheng\app\build\outputs\apk\app-debug.apk /data/local/tmp/com.example.q9722.bianchengn$ adb shell pm install -r "/data/local/tmp/com.example.q9722.biancheng"nSuccessnnn$ adb shell am start -n "com.example.q9722.biancheng/com.example.q9722.biancheng.SplashActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHERnClient not ready yet..Waiting for process to come onlinenConnected to process 30129 on device xiaomi-mi_5-43ac216fnW/System: ClassLoader referenced unknown path: /data/app/com.example.q9722.biancheng-1/lib/arm64nI/InstantRun: Instant Run Runtime started. Android package is com.example.q9722.biancheng, real application class is null.nW/System: ClassLoader referenced unknown path: /data/app/com.example.q9722.biancheng-1/lib/arm64nW/MIUI-BLOCK-MONITOR: The msg when=-72ms what=110 obj=AppBindDataappInfo=ApplicationInfo7c1e14a com.example.q9722.biancheng target=android.app.ActivityThread$H planTime=1514804333143 dispatchTime=1514804333215 finishTime=0 took 3826ms and took 3754ms after dispatch.nW/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.DrawablenW/System: ClassLoader referenced unknown path: /system/app/MiuiContentCatcher/lib/arm64nD/AccessibilityManager: current package=com.example.q9722.biancheng, accessibility manager mIsFinalEnabled=false, mOptimizeEnabled=true, mIsUiAutomationEnabled=false, mIsInterestedPackage=falsenV/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@717395nV/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@bc3ccaanV/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@664d14enD/ActivityThreadInjector: clearCachedDrawables.nI/Adreno: QUALCOMM build : 620c068, I09d312ff84n Build Date : 08/07/17n OpenGL ES Shader Compiler Version: XE031.09.00.04n Local Branch : n Remote Branch : n Remote Branch : n Reconstruct Branch : nI/Choreographer: Skipped 33 frames! The application may be doing too much work on its main thread.nI/OpenGLRenderer: Initialized EGL, version 1.4nD/OpenGLRenderer: Swap behavior 1nV/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@c8e9e47nI/Timeline: Timeline: Activity_launch_request time:84494803nV/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@cd359d1nV/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@4011c36nD/AndroidRuntime: Shutting down VMnE/AndroidRuntime: FATAL EXCEPTION: mainn Process: com.example.q9722.biancheng, PID: 30129n java.lang.RuntimeException: Unable to start activity ComponentInfocom.example.q9722.biancheng/com.example.q9722.biancheng.MainActivity: android.view.InflateException: Binary XML file line #15: Binary XML file line #15: Error inflating class com.example.q9722.biancheng.test_textn at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2724)n at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2785)n at android.app.ActivityThread.-wrap12(ActivityThread.java)n at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1532)n at android.os.Handler.dispatchMessage(Handler.java:102)n at android.os.Looper.loop(Looper.java:163)n at android.app.ActivityThread.main(ActivityThread.java:6321)n at java.lang.reflect.Method.invoke(Native Method)n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)n Caused by: android.view.InflateException: Binary XML file line #15: Binary XML file line #15: Error inflating class com.example.q9722.biancheng.test_textn Caused by: android.view.InflateException: Binary XML file line #15: Error inflating class com.example.q9722.biancheng.test_textn Caused by: java.lang.NoSuchMethodException: [class android.content.Context, interface android.util.AttributeSet]n at java.lang.Class.getConstructor0(Class.java:2204)n at java.lang.Class.getConstructor(Class.java:1683)n at android.view.LayoutInflater.createView(LayoutInflater.java:622)n at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:812)n at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:752)n at android.view.LayoutInflater.rInflate(LayoutInflater.java:883)n at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)n at android.view.LayoutInflater.inflate(LayoutInflater.java:522)n at android.view.LayoutInflater.inflate(LayoutInflater.java:430)n at android.view.LayoutInflater.inflate(LayoutInflater.java:377)n at android.support.v7.app.AppCompatDelegateImplV9.setContentView(AppCompatDelegateImplV9.java:284)n at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)n at com.example.q9722.biancheng.MainActivity.onCreate(MainActivity.java:17)n at android.app.Activity.performCreate(Activity.java:6847)n at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)n at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2677)n at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2785)n at android.app.ActivityThread.-wrap12(ActivityThread.java)n at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1532)n at android.os.Handler.dispatchMessage(Handler.java:102)n at android.os.Looper.loop(Looper.java:163)n at android.app.ActivityThread.main(ActivityThread.java:6321)n at java.lang.reflect.Method.invoke(Native Method)n at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)n at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:770)nApplication terminated.n
项目异常:java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
Dispatcher initialization failedrnjava.lang.RuntimeException: java.lang.reflect.InvocationTargetExceptionrn at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:301)rn at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:438)rn at com.opensymphony.xwork2.inject.ContainerBuilder$5.create(ContainerBuilder.java:207)rn at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)rn at com.opensymphony.xwork2.inject.ContainerBuilder$3.create(ContainerBuilder.java:93)rn at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:487)rn at com.opensymphony.xwork2.inject.ContainerBuilder$7.call(ContainerBuilder.java:484)rn at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:580)rn at com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.java:484)rn at com.opensymphony.xwork2.config.impl.DefaultConfiguration.createBootstrapContainer(DefaultConfiguration.java:288)rn at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:205)rn at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)rn at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)rn at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)rn at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)rn at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)rn at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)rn at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:115)rn at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)rn at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)rn at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)rn at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)rn at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)rn at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)rn at org.apache.catalina.core.StandardService.start(StandardService.java:525)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:595)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)rnCaused by: java.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)rn at java.lang.reflect.Method.invoke(Unknown Source)rn at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:299)rn ... 42 morernCaused by: java.lang.ExceptionInInitializerErrorrn at com.opensymphony.xwork2.ognl.OgnlValueStackFactory.setContainer(OgnlValueStackFactory.java:85)rn ... 47 morernCaused by: java.lang.IllegalArgumentException: Javassist library is missing in classpath! Please add missed dependency!rn at ognl.OgnlRuntime.(OgnlRuntime.java:168)rn ... 48 morernCaused by: java.lang.ClassNotFoundException: javassist.ClassPoolrn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)rn at java.lang.Class.forName0(Native Method)rn at java.lang.Class.forName(Unknown Source)rn at ognl.OgnlRuntime.(OgnlRuntime.java:165)rn ... 48 morern
第一次做用户自定义控件,几个问题
第一次做了个自定义控件,方法感觉和在form上放控件差不多,呵呵,可是有几个问题:rn1:不能在现有的form上通过rnUserControl1 uc1=new UserControl1();rnuc1.Show();rn这样的语句显示它,怎么回事,既然它有show()这个方法为何没作用???rn2:我界面上有个像outlook左边一样的bar ,我想我的控件show出来后最大化,左边贴着我已有的outlook bar ,上下和右边就靠边就行,请问如何设置??rn谢谢!!
java.lang.RuntimeException异常,请大神赐教!!!
11-18 09:39:51.281 19604-19604/com.example.admin.emotion E/AndroidRuntime: FATAL EXCEPTION: mainrn Process: com.example.admin.emotion, PID: 19604rn java.lang.RuntimeException: Unable to start activity ComponentInfocom.example.admin.emotion/com.example.admin.emotion.MainFragment: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setOnClickListener(android.view.View$OnClickListener)' on a null object referencern at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2793)rn at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864)rn at android.app.ActivityThread.-wrap12(ActivityThread.java)rn at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567)rn at android.os.Handler.dispatchMessage(Handler.java:105)rn at android.os.Looper.loop(Looper.java:156)rn at android.app.ActivityThread.main(ActivityThread.java:6524)rn at java.lang.reflect.Method.invoke(Native Method)rn at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941)rn at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)rn Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.setOnClickListener(android.view.View$OnClickListener)' on a null object referencern at com.example.admin.emotion.MainFragment.initView(MainFragment.java:80)rn at com.example.admin.emotion.MainFragment.onCreate(MainFragment.java:59)rn at android.app.Activity.performCreate(Activity.java:6910)rn at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)rn at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2746)rn at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2864) rn at android.app.ActivityThread.-wrap12(ActivityThread.java) rn at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1567) rn at android.os.Handler.dispatchMessage(Handler.java:105) rn at android.os.Looper.loop(Looper.java:156) rn at android.app.ActivityThread.main(ActivityThread.java:6524) rn at java.lang.reflect.Method.invoke(Native Method) rn at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:941) rn at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831) rn出问题的代码:rnprotected void onCreate(Bundle savedInstanceState) rn rn super.onCreate(savedInstanceState);rn setContentView(R.layout.content_main);rn fragmentManager = getSupportFragmentManager();rn initView();rn setChioceItem(0);rn rnrn private void initView() rn firstImage = (ImageView) findViewById(R.id.first_image);rn secondImage = (ImageView) findViewById(R.id.second_image);rn thirdImage = (ImageView) findViewById(R.id.third_image);rn fourthImage = (ImageView) findViewById(R.id.fourth_image);rn firstText = (TextView) findViewById(R.id.first_text);rn secondText = (TextView) findViewById(R.id.second_text);rn thirdText = (TextView) findViewById(R.id.third_text);rn fourthText = (TextView) findViewById(R.id.fourth_text);rn firstLayout = (RelativeLayout) findViewById(R.id.first_layout);rn secondLayout = (RelativeLayout) findViewById(R.id.second_layout);rn thirdLayout = (RelativeLayout) findViewById(R.id.third_layout);rn fourthLayout = (RelativeLayout) findViewById(R.id.fourth_layout);rnrn firstLayout.setOnClickListener(MainFragment.this);rn secondLayout.setOnClickListener(MainFragment.this);rn thirdLayout.setOnClickListener(MainFragment.this);rn fourthLayout.setOnClickListener(MainFragment.this);rn
java.lang.runtimeException此类异常如何处理
![![![![![![![![图片说明](https://img-ask.csdn.net/upload/201607/01/1467351691_439972.png)图片说明](https://img-ask.csdn.net/upload/201607/01/1467351685_502914.png)图片说明](https://img-ask.csdn.net/upload/201607/01/1467351679_326830.png)图片说明](https://img-ask.csdn.net/upload/201607/01/1467351672_997006.png)图片说明](https://img-ask.csdn.net/upload/201607/01/1467351666_534647.png)图片说明](https://img-ask.csdn.net/upload/201607/01/1467351657_218623.png)图片说明](https://img-ask.csdn.net/upload/201607/01/1467351647_261734.png)图片说明](https://img-ask.csdn.net/upload/201607/01/1467351639_606366.png)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.Run
严重: Exception starting filter struts2rnjava.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException - Class: com.opensymphony.xwork2.inject.ContainerBuilder$4rnFile: ContainerBuilder.javarnMethod: creaternLine: 132 - com/opensymphony/xwork2/inject/ContainerBuilder.java:132:-1rn at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:450)rn at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:74)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)rn at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)rn at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)rn at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)rn at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:103)rn at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4638)rn at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5294)rn at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)rn at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1099)rn at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1621)rn at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)rn at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)rn at java.util.concurrent.FutureTask.run(FutureTask.java:166)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)rn at java.lang.Thread.run(Thread.java:722)rnCaused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetExceptionrn at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132)rn at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)rn at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:514)rn at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:524)rn at com.opensymphony.xwork2.inject.ContainerImpl$9.call(ContainerImpl.java:555)rn at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:580)rn at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:553)rn at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:227)rn at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)rn at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)rn at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:437)rn ... 20 morernCaused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetExceptionrn at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:502)rn at com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:539)rn at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:589)rn at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:537)rn at com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFactory.java:32)rn at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:130)rn ... 30 morernCaused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetExceptionrn at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:447)rn at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:499)rn ... 35 morernCaused by: java.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:525)rn at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:426)rn ... 36 morernCaused by: java.lang.NoClassDefFoundError: org/springframework/web/context/WebApplicationContextrn at org.apache.struts2.spring.StrutsSpringObjectFactory.(StrutsSpringObjectFactory.java:80)rn ... 41 morernCaused by: java.lang.ClassNotFoundException: org.springframework.web.context.WebApplicationContextrn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)rn ... 42 morern
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeExcepti
[code=Java]rnSLF4J: Found binding in [jar:file:/C:/Documents%20and%20Settings/Administrator/Workspaces/MyEclipse%208.6/.metadata/.me_tcat/webapps/Assess/WEB-INF/lib/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]rnSLF4J: Found binding in [jar:file:/C:/Documents%20and%20Settings/Administrator/Workspaces/MyEclipse%208.6/.metadata/.me_tcat/webapps/Assess/WEB-INF/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]rnSLF4J: Found binding in [jar:file:/C:/Documents%20and%20Settings/Administrator/Workspaces/MyEclipse%208.6/.metadata/.me_tcat/webapps/Assess/WEB-INF/lib/slf4j-nop-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]rnSLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.rn2011-07-13 20:58:37,921 ERROR [org.apache.struts2.dispatcher.Dispatcher] - Dispatcher initialization failedrnjava.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetExceptionrn at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132)rn at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)rn at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:507)rn at com.opensymphony.xwork2.inject.ContainerImpl$8.call(ContainerImpl.java:540)rn at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:574)rn at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:538)rn at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:213)rn at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)rn at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:380)rn at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424)rn at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)rn at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)rn at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)rnrn…… at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)rnCaused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetExceptionrn at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:495)rn at com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:532)rn at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:581)rn at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:530)rn at com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFactory.java:32)rn at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:130)rn ... 38 morernCaused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetExceptionrn at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:440)rn at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:492)rn ... 43 morernCaused by: java.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:513)rn at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:419)rn ... 44 morernCaused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetExceptionrn at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132)rn at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)rn at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:507)rn at com.opensymphony.xwork2.inject.ContainerImpl$8.call(ContainerImpl.java:540)rn at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:581)rn at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:538)rn at org.apache.struts2.convention.ClasspathConfigurationProvider.(ClasspathConfigurationProvider.java:47)rn rn... 49 morernCaused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetExceptionrnrn ... 55 morernCaused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetExceptionrn at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:440)rn at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:492)rn ... 60 morernCaused by: java.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance ... 61 morernCaused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetExceptionrn at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132)rn at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51)rn at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:507)rn at com.opensymphony.xwork2.inject.ContainerImpl$8.call(ContainerImpl.java:540)rn at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:581)rn at com.opensymphony.xwork2.inject.ContainerImpl.getInstance(ContainerImpl.java:538)rn at org.apache.struts2.convention.PackageBasedActionConfigBuilder.(PackageBasedActionConfigBuilder.java:130)rn ... 66 morernCaused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetExceptionrn at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:495)rn at com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:532)rn at com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl.java:581)rn at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:530)rn at com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFactory.java:32)rn at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:130)rn ... 72 morernCaused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetExceptionrn at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:295)rn at com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.construct(ContainerImpl.java:431)rn at com.opensymphony.xwork2.inject.ContainerImpl.inject(ContainerImpl.java:492)rn ... 77 morernCaused by: java.lang.reflect.InvocationTargetExceptionrn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(ContainerImpl.java:293)rn ... 79 morernCaused by: java.lang.NoClassDefFoundError: org/apache/commons/lang/xwork/StringUtilsrn at org.apache.struts2.convention.SEOActionNameBuilder.setActionSuffix(SEOActionNameBuilder.java:55)rn ... 84 morernCaused by: java.lang.ClassNotFoundException: org.apache.commons.lang.xwork.StringUtilsrn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1358)rn at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1204)rn at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)rn ... 85 morern2011-7-13 20:58:37 org.apache.catalina.core.StandardContext filterStartrn严重: Exception starting filter Struts2rnjava.lang.RuntimeException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException - Class: com.opensymphony.xwork2.inject.ContainerBuilder$4rnFile: ContainerBuilder.javarn2011-7-13 20:58:37 org.apache.catalina.core.StandardContext startrn严重: Error filterStartrn2011-7-13 20:58:37 org.apache.catalina.core.StandardContext startrn严重: Context [/Assess] startup failed due to previous errorsrn[/code]rnrn网上搜的是缺少javassist-3.7.ga.jar,rn我用的是struts-2.2.3,并且把它带的javassist-3.11.0.GA.jar放到lib下面了rnrn问题依旧存在啊rn求高手指教
java.lang.runtimeexception
在安卓模拟器上运行程序主界面时显示如下错误,求大神指点啊rn[img=https://img-bbs.csdn.net/upload/201508/04/1438655253_840295.png][/img]
java.lang.RuntimeException
主函数中出现 java.lang.RuntimeException: Stub! 怎么回事啊 请高手赐教!鄙人感激不尽!rn
Android自定义控件开发系列(一)——第一次动手做自定义控件
Android系统提供的控件多种多样,以至于很多初学者经常忘了还有这样那样的控件没用过甚至没听过。尽管如此,但是系统控件大多比较死板,而且不够美观,很多多样化的显示或是交互方式都没法完成。每每遇到这种情况,就需要我们来开发我们自己的控件了——所谓的“自定义控件”。接下来我们就一步一步扎扎实实的从头开始Android自定义控件的开发。
Android 运行报错java.lang.RuntimeException: Cannot serialize
java.lang.RuntimeException: Cannot serialize: wcs : [com.eagle.model.Wcs@419f2800]rn运行报错,帮忙解决一下!
请问这个java.lang.RuntimeException异常原因是什么
执行以下代码时,提示Exception in thread "main" java.lang.ExceptionInInitializerErrorrnCaused by: java.lang.RuntimeException: big.txt not found!!!rnjava菜鸟,请问谁能指点一下这个异常的原因呢,big.txt是存在的啊。rnpublic static Map train()rn [color=#FF6600][color=#FF0000]InputStream is = new SpellCorrect().getClass().getClassLoader().getResourceAsStream("big.txt");rn if(is == null)rn throw new RuntimeException("big.txt not found!!!");rn rn Map map = new HashMap();[/color][/color]rn try rn //读取语料库big.txtrn BufferedReader br = new BufferedReader(new InputStreamReader(is , "UTF-8"), 512);rn String s="";rn while ((s = br.readLine()) != null) rn // 去掉文档中除字母外的所有符号rn s = s.replaceAll("\\pP|\\pS|\\pM|\\pN|\\pC", "");rn // 将文档转成小写,然后切分成单词,存在list中rn s = s.toLowerCase();rn String[] splits = s.split(" ");rn for (int j = 0; j < splits.length; j++) rn if (!" ".equals(splits[j]) && !"".equals(splits[j]) && !splits[j].equals(null))rn if(map.containsKey(splits[j]))rn Integer count=map.get(splits[j]);rn map.put(splits[j], count+1);rn elsern map.put(splits[j], 1);rn rn rn rn rn catch (FileNotFoundException e) rn e.printStackTrace();rn catch(IOException e)rn e.printStackTrace();rn rn finallyrn tryrn is.close();rn catch(Exception e)rn e.printStackTrace();rn rn rn return map;rn
java.lang.RuntimeException: <0.9.7-incubating fatal user error> 异常的处理
在配置roller4.0.1时,报openJPA的异常,文件用jar包时,不会出错,当用源代码时就包这个异常,这是什么原因??rnrn严重: Exception sending context initialized event to listener instance of class org.apache.roller.weblogger.ui.core.RollerContextrnjava.lang.RuntimeException: <0.9.7-incubating fatal user error> org.apache.openjpa.persistence.ArgumentException: The type "class org.apache.roller.weblogger.pojos.TaskLock" has not been enhanced.rn at org.apache.roller.weblogger.business.jpa.JPAPropertiesManagerImpl.initialize(JPAPropertiesManagerImpl.java:96)rn at org.apache.roller.weblogger.business.WebloggerImpl.initialize(WebloggerImpl.java:303)rn at org.apache.roller.weblogger.ui.core.RollerContext.contextInitialized(RollerContext.java:159)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)rn at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)rn at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)rn at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)rn at org.apache.catalina.core.StandardService.start(StandardService.java:516)rn at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)rn at org.apache.catalina.startup.Catalina.start(Catalina.java:578)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)rn at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)rnCaused by: <0.9.7-incubating fatal user error> org.apache.openjpa.persistence.ArgumentException: The type "class org.apache.roller.weblogger.pojos.TaskLock" has not been enhanced.rn at org.apache.openjpa.meta.ClassMetaData.resolveMeta(ClassMetaData.java:1606)rn at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1580)rn at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:659)rn at org.apache.openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java:559)rn at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:484)rn at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:288)rn at org.apache.openjpa.meta.MetaDataRepository.resolveAll(MetaDataRepository.java:1523)rn at org.apache.openjpa.meta.MetaDataRepository.getQueryMetaData(MetaDataRepository.java:1498)rn at org.apache.openjpa.persistence.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:782)rn at org.apache.openjpa.persistence.EntityManagerImpl.createNamedQuery(EntityManagerImpl.java:65)rn at org.apache.roller.weblogger.business.jpa.JPAPersistenceStrategy.getNamedQuery(JPAPersistenceStrategy.java:274)rn at org.apache.roller.weblogger.business.jpa.JPAPropertiesManagerImpl.getProperties(JPAPropertiesManagerImpl.java:121)rn at org.apache.roller.weblogger.business.jpa.JPAPropertiesManagerImpl.initialize(JPAPropertiesManagerImpl.java:77)rn ... 17 more
Android 自定义控件 自定义属性 无法找到报异常
主要是属性名字错误,所以无法找到,需要仔细检测 xmlns:app="http://schemas.android.com/apk/res-auto" 上面这句不能是引用到tools地址,如下 xmlns:tools="http://schemas.android.com/tools"
Android中自定义控件报InflateException异常
在写一个自定义Button时报InflateException异常,因为只写了一个参数的构造方法, public MyButton(Context context) { super(context); initPaint(); } 然后又添加了一个两个参数的构造方法就解决了。 public MyButton(Context context, AttributeSe
java.lang.RuntimeException: java.lang.NoClassDefFoundError
开发过程中错误不断:rn望大虾们指教rn State: FAILEDrn Reason: java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/apache/tapestry/util/text/LocalizedPropertiesrn I Depend On:rn jboss.jca:service=DataSourceBinding,name=jdbc/sportsrn Depends On Me:rn jboss.j2ee:jar=e10-rumba-log.jar,name=BootLog,service=EJB3rn jboss.j2ee:jar=e10-rumba-log.jar,name=RB.log.ActionLogMgr,service=EJB3rn jboss.j2ee:jar=e10-rumba-log.jar,name=RB.log.RJobLogMgr,service=EJB3rn jboss.j2ee:jar=e10-rumba-log.jar,name=RB.log.ModuleLogMgr,service=EJB3rn jboss.j2ee:jar=e10-rumba-log.jar,name=RB.log.ProcessLogMgr,service=EJB3rn jboss.j2ee:jar=e10-rumba-log.jar,name=RB.log.LogQueryMgr,service=EJB3rn jboss.j2ee:jar=e10-rumba-log.jar,name=RB.log.VerCtrlRumbaLogMgr,service=EJB3
第一次做的
添加代码: static string   connstring = "server=NET2-15//NET2;database=BMS;UID=sa;Pwd=server";    SqlConnection myconn = new SqlConnection(connstring);    protected void Page_Load(object sender, Ev
java.lang.RuntimeException求救
// CRASH: com.android.HelloMiss (pid 481)rnrnrn// Short Msg: java.lang.NullPointerExceptionrnrnrn// Long Msg: java.lang.NullPointerException: Error receiving broadcast Intent act=com.android.HelloMiss.SMS_CHANGED in com.android.HelloMiss.Too$1@447f2238rnrnrn// java.lang.RuntimeException: Error receiving broadcast Intent act=com.android.HelloMiss.SMS_CHANGED in com.android.HelloMiss.Too$1@447f2238rnrnrn// at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:905)rnrnrn// at android.os.Handler.handleCallback(Handler.java:587)rnrnrn// at android.os.Handler.dispatchMessage(Handler.java:92)rnrnrn// at android.os.Looper.loop(Looper.java:123)rnrnrn// at android.app.ActivityThread.main(ActivityThread.java:4673)rnrnrn// at java.lang.reflect.Method.invokeNative(Native Method)rnrnrn// at java.lang.reflect.Method.invoke(Method.java:521)rnrnrn// at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:880)rnrnrn// at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:638)rnrnrn// at dalvik.system.NativeStart.main(Native Method)rnrnrn// Caused by: java.lang.NullPointerExceptionrnrnrn// at com.android.HelloMiss.Too$1.onReceive(Too.java:209)rnrnrn// at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:892)rnrnrn// ... 9 morernrnrn// rnrnrnpublic void onReceive(Context context, Intent intent) rn // TODO Auto-generated method stubrn if (intent.getAction().equals(Service.Po_CHANGED)) rn madapter.notifyDataSetChanged();rn else rn [color=#FF0000] madapter.notifyDataSetChanged();//报错所指向的是这一行[/color]rn setCurrentDateTime(curposition);rn rnrn
GIT 第一次 clone 异常
Git config –global http.sslVerify false
Android自定义控件
       在android开发中,高级ui经常用到自定义控件,本文写一个小例题,毛雀虽小,五脏俱全,记录下view绘制中用到的三个回调方法:onMeasure()   onLayout()  onDraw();对于ViewGroup子类容器,必然要回调onLayout对其子控件进行布局和大小设置,搞懂onLayout方法的使用,理解下图是关键: android布局层级 下面来写一个...
android 自定义控件
android 自定义控件学习整理 自定控件是每个android攻城狮都必需掌握的重要技能 自定义控件可以大致的分为组合控件,绘制控件和继承控件 比如我想给textview加一个边框,原来的textview是没有这个功能的,那么我想实现这个功能就需要使用自定义控件,由于只需要在原来的基础上加绘制边框即可,就使用继承控件,注意继承的时候要重写构造器。 那我们就需要获取控件的长和宽,并进行绘制,绘制方...
android SurfaceView详解
传送门
android自定义控件
Android自定义控件,里面有lol技能分析板、时钟、还有个加速球(可能不是很完善)
Android 自定义控件
为什么使用自定义控件? 一般像我们初学者,在做界面的过程中输入框(EditView)是经常用到的。为了用户填写信息区别开来我们往往会在EditView前面加个文本框(TextView)类似的输入(姓名:、年龄:…)。那么问题来了如果要输入的信息有7到8条呢,是不是很麻烦,这其中还会涉及到布局问题。所以我分享一种更方便的方法让他们两个控件变成一个怎么样。 my_edit_view.xml // An...
Android之自定义控件
自定义控件 从已有的基本控件对象继承派生出隶属于应用自己的控件对象,通过重载等手段,将控件的样式、功能和事件处理进行变更,使其满足产品的需求,跟高效的构建交互界面。     在自定义控件的构造函数中,通常有一个Init函数,对自定义的控件的样式参数初始化。在界面开发中,不应该在代码中直接定义与界面相关信息,而是把常量信息放到资源文件中,利用Android资源文件的可配置性,在不同尺寸、不同界...
Android—自定义控件
自定义控件的步骤: 1.自定义属性的声明和获取 分析需要的自定义属性 在res/valus/attrs.xml定义声明 在layout.xml文件中进行使用 在View的构造方法中进行获取 2.测量onMeasure 3.绘制onDraw 4.状态的存储和恢复(考虑在activity重建之后要存储和恢复的) 主要是通过onSaveInstanceState()(实现存储)和onRe...
Android——自定义控件
**引入布局的技巧确实解决了重复编写布局代码的问题,但是如果布局中有一些控件要求 能够响应事件,我们还是需要在每个活动中为这些控件单独编写一次事件注册的代码。比如 说标题栏中的返回按钮,其实不管是在哪一个活动中,这个按钮的功能都是相同的,即销毁 掉当前活动。而如果在每一个活动中都需要重新注册一遍返回按钮的点击事件,无疑又是增 加了很多重复代码,这种情况最好是使用自定义控件的方式来解决。 ** 新...
相关热词 c# 去空格去转义符 c#用户登录窗体代码 c# 流 c# linux 可视化 c# mvc 返回图片 c# 像素空间 c# 日期 最后一天 c#字典序排序 c# 截屏取色 c#中的哪些属于托管机制