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

show Toast mesage till video installation and play it
change the layout of activity
Customised video player full screen android
Ionic fetch contacts for android
Implementing Ripple effect outside ImageButton
RECEIVE_BOOT_COMPLETED does not work
The type 'System.ComponentModel.INotifyPropertyChanged' is defined in an assembly that is not referenced
Android UI is not showing up again because of glThread in Coco2d-x javascript
Start/end & left/right for RTL languages in Android 4.2
Cannot be resolved or is not a field facebook
image not displaying inside an activity after capturing the image from camera in android
Android ADT build path issue, how to fix?
Use UncaughtExceptionHandler to do what Android usually does plus extra functionality I need
How to properly implement an Adapter for a ListView
Fatal Exception IllegalStateException. Could not execute method of the activity
Google navigation dialog box “you're navigating a route ”

Categories

HOME
jmx
interface
pascal
jwplayer
socket.io
nuget
pdfbox
static-site
carousel
pyqt4
zip
computer-science
p2p
syntaxnet
filechannel
jsonpath
naivebayes
openbugs
libc
stellar.js
production
google-maps-autocomplete
gulp-watch
r-mice
postscript
hta
nstimer
intersystems-cache
winexe
constexpr
panoramas
event-flow
paragraph
utorrent
testbed
hreflang
android-maps-extensions
python-import
imx6
git-rewrite-history
odroid
chef-solo
contract
photos
vaadin-charts
snapchat
puredata
dynamic-linq
ntvs
appdomain
yii2-user
colorbar
jqchart
offline.js
choice
vcloud-director-rest-api
windows-azure-queues
scaffolding
aurora
cda
aspen
mobiledoc-kit
jbase
roadkill-wiki
graphics2d
nutiteq
broadband
openbabel
grouping-sets
angular-gettext
iiop
teaspoon
genymotion-call
trdion2011
verold
personalization
decoupling
twitter-bootstrap-rails
square-bracket
sphinxql
breakout
poker
chart-director
twisted.web
alice
argouml
qi4j
extconf.rb
denied
fsevents
google-ajax-api
duplex
murmurhash
complex-event-processing
localizable.strings

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