static String text;
final TextView done = (TextView)findViewById(R.id.tvName);
public void afterTextChanged(Editable s) {
String text = First.getText().toString();
done.setText(text);
}
});
c.drawText(text, 200, 300, paint);
これは私のアプリのサンプルコードです。私はeditText
( First
) とTextView
( done
) を吹き飛ばしましEditText
たtextView
。細かい..しかし、今私は..を使用editText
して描画したい..しかし、それは動作しません..そう..TextViewがHello c.drawText helloの場合..文字列を使用しようとしましたが、動作しません..文字列はtextView
canvas c.drawText
text
これはlogcatです:
08-23 13:34:26.010: D/AndroidRuntime(21371): Shutting down VM
08-23 13:34:26.010: W/dalvikvm(21371): threadid=1: thread exiting with uncaught exception (group=0x40a6e228)
08-23 13:34:26.050: E/AndroidRuntime(21371): FATAL EXCEPTION: main
08-23 13:34:26.050: E/AndroidRuntime(21371): java.lang.NullPointerException
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.graphics.Canvas.drawText(Canvas.java:1377)
08-23 13:34:26.050: E/AndroidRuntime(21371): at text.app.text.StartActivity.applyFrame(StartActivity.java:157)
08-23 13:34:26.050: E/AndroidRuntime(21371): at text.app.text.StartActivity$2.onItemClick(StartActivity.java:106)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.widget.AdapterView.performItemClick(AdapterView.java:292)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.widget.Gallery.onSingleTapUp(Gallery.java:960)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.GestureDetector.onTouchEvent(GestureDetector.java:594)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.widget.Gallery.onTouchEvent(Gallery.java:937)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.View.dispatchTouchEvent(View.java:5568)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2064)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1732)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2070)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1746)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2070)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1746)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2070)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1746)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2070)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1746)
08-23 13:34:26.050: E/AndroidRuntime(21371): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1961)
08-23 13:34:26.050: E/AndroidRuntime(21371): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1398)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.app.Activity.dispatchTouchEvent(Activity.java:2428)
08-23 13:34:26.050: E/AndroidRuntime(21371): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1909)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.View.dispatchPointerEvent(View.java:5748)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3141)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2695)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.ViewRootImpl.processInputEvents(ViewRootImpl.java:935)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2709)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.os.Handler.dispatchMessage(Handler.java:99)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.os.Looper.loop(Looper.java:154)
08-23 13:34:26.050: E/AndroidRuntime(21371): at android.app.ActivityThread.main(ActivityThread.java:4974)
08-23 13:34:26.050: E/AndroidRuntime(21371): at java.lang.reflect.Method.invokeNative(Native Method)
08-23 13:34:26.050: E/AndroidRuntime(21371): at java.lang.reflect.Method.invoke(Method.java:511)
08-23 13:34:26.050: E/AndroidRuntime(21371): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-23 13:34:26.050: E/AndroidRuntime(21371): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-23 13:34:26.050: E/AndroidRuntime(21371): at dalvik.system.NativeStart.main(Native Method)
08-23 13:34:26.130: D/dalvikvm(21371): GC_CONCURRENT freed 2452K, 32% free 10589K/15395K, paused 2ms+3ms
08-23 13:34:27.430: D/Process(21371): killProcess, pid=21371
08-23 13:34:27.450: D/Process(21371): dalvik.system.VMStack.getThreadStackTrace(Native Method)
08-23 13:34:27.450: D/Process(21371): java.lang.Thread.getStackTrace(Thread.java:599)
08-23 13:34:27.450: D/Process(21371): android.os.Process.killProcess(Process.java:807)
08-23 13:34:27.450: D/Process(21371): com.android.internal.os.RuntimeInit$UncaughtHandler.uncaughtException(RuntimeInit.java:104)
08-23 13:34:27.450: D/Process(21371): java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:693)
08-23 13:34:27.450: D/Process(21371): java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:690)
08-23 13:34:27.450: D/Process(21371): dalvik.system.NativeStart.main(Native Method)
08-23 13:34:27.450: I/Process(21371): Sending signal. PID: 21371 SIG: 9