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

Loader and LoaderManager - how to determine if there was an error loading
How to pass in android a RPC Json with nested parameters
Configuration file for an Android game to test/tweak games in comfortable way
What is the use of the res/values/public.xml file on Android?
Android SQLite Exception: unable to close due to unfinalised statements
Quickly (100Hz or more) blinking of camera flashlight LED
class extends ListActivity “whose id attribute is 'android.R.id.list'”
getTag() always null in onListItemClick
HP TouchPad USB driving on Android
grab frame from video in Android
Programmatically Changing a XML file?
how to kill all activities in android application?
SDcard only RO even after set permissions
Creating Files in Android JUnit
How do I get my Android TODOs to show up in Tasks in Eclipse?
Title bar in android app is still apperaring

Categories

HOME
android
url-redirection
phantom-dsl
grok
facebook-oauth
checkstyle
static
obfuscation
devise
knitr
telegram-bot
limit
echo
bing-maps
qpython
octave
endeca
resultset
mxgraph
rtf
dynatrace
scrolltop
mapstruct
babel
postscript
dynamically-generated
pic32
nstimer
tizen-tv
kodi
git-squash
memory-address
gojs
keras-layer
indy10
sql-delete
raft
salesforce-communities
xcode7.3
watchman
projects-and-solutions
typesafe-config
p4merge
photos
clang++
strftime
phpdbg
jboss-4.2.x
openresty
configurationmanager
trojan
semantic-logging
gpg-signature
custom-lists
jquery-jscrollpane
i386
eigenvector
nss
thread-sleep
design-principles
dynamics-nav-2016
assertion
microsoft-reporting
android-launcher
jdk1.7
omnifaces
cryptographichashfunction
ejb-2.x
easyrtc
webfinger
ie8-compatibility-mode
away3d
inappsettingskit
mongohq
actiondispatch
composite-component
curb
fragmenttransaction
boost-msm
subproject
apache-whirr
procedures
winmain
webdev.webserver
quotation-marks
load-time
hbm2java
message-passing
cfwindow
strtod
mathematical-notation
sun

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