android


Saving canvas draw in bitmap showing white screen


I am trying to save canvas draw into bitmap using this code:
#Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
myBitmap=Bitmap.createBitmap((int)this.getWidth(), (int)this.getHeight(), Config.ARGB_8888);// bitmap created
canvas=new Canvas(myBitmap);
canvas.drawPath(path, paint);
}
For paint code :
public TouchEventView(Context context, AttributeSet attrs) {
super(context, attrs);
// TODO Auto-generated constructor stub
paint.setAntiAlias(true);
paint.setColor(Color.BLUE);
paint.setStrokeJoin(Paint.Join.ROUND);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(5);
}
According to the concept it should draw lines on touching screen but when I run the app code only white screen shows and I am not able to draw anything!
Note:
The app runs correctly if I remove:
myBitmap=Bitmap.createBitmap((int)this.getWidth(), (int)this.getHeight(), Config.ARGB_8888);// bitmap created
canvas=new Canvas(myBitmap);
But I want to save my canvas in a bitmap for future processing .
How to save canvas in bitmap correctly ? What changes should I bring ?

Related Links

Ionic BUILD FAILED when running “ionic run android”
In app billing issue
Android ListView click set all Checkboxs to enabled
Thread synchronization in android
Unable to build PlusClient with gradle (Android Studio)
Pro and cons calling finish
Setting value in AutoCompleteTextView
comparing two spanned strings in edittext in android
Draw security pattern on Android view with Appium
get data from json and put it in spinner with prompt
How to access methods of a service from its calling activity?
Robolectric 3.0 with Facebook sdk 4.0
Does Cordova support gzipped responses?
Upgrade pre-installed database with new data
Making Executable Sqlite Comands Android
How to add a Jar file to a Cordova plugin for Android without compiling it into the APK

Categories

HOME
uml
httparty
twitter-bootstrap-3
cobalt
socket.io
owl-carousel
bitbucket-api
entity-framework-core
tivoli
ado.net
vsm
python-multithreading
nstableheaderview
performancepoint
gson
flatpak
docx
altera
azure-powershell
glyphicons
forgot-password
foreign-keys
gmm
topology
asciidoctor-pdf
jquery-ias
pagespeed
ckfinder
dapper-extensions
surveymonkey
shared
apktool
bringtofront
vex
eviews
aws-codecommit
erb
hibernate-search
alphabetical
amazon-ses
gdata
diacritics
stringtokenizer
watchface
glm-math
print-css
plr
logback-groovy
http-request
vaadin-elements
dynamic-linq
twilio-click-to-call
sundials
type-theory
lsyncd
baidu
javafx-css
taocp
smartfoxserver
pytables
microstation
qtplugin
lrs
file-uri
drawstring
ng-grid
ellucian-scribe
thread-sleep
atan2
visual-sourcesafe-2005
typemock
baasbox
graphics2d
adehabitathr
nodelist
iiop
structuremap3
tweenlite
nsmenu
encryption-asymmetric
lambda-architecture
memset
menubar
openargs
scrypt
ice-cube
cffile
kaleidoscope
device-width
extreme-programming
sentestingkit
wcf-configuration
josql
mapping-by-code
jsr286
luabind
expression-blend-4
winmain
umra
unattended-processing
resharper-6.0
maven-1
information-management
xslcompiledtransform
leader

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App