Advertisement
Guest User

Untitled

a guest
Aug 31st, 2014
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <RelativeLayout
  3. xmlns:android="http://schemas.android.com/apk/res/android"
  4. android:layout_width="match_parent"
  5. android:layout_height="match_parent"
  6. android:orientation="vertical">
  7. <ImageView
  8. android:id="@+id/stage"
  9. android:layout_width="match_parent"
  10. android:layout_height="match_parent"
  11.  
  12. />
  13. </RelativeLayout>
  14.  
  15. public class MyWidget extends AppWidgetProvider {
  16.  
  17. Bitmap bitmap;
  18. Bitmap bckgrnd;
  19. Bitmap over;
  20.  
  21. @Override
  22. public void onEnabled(Context context) {
  23. super.onEnabled(context);
  24.  
  25. RemoteViews widgetView = new RemoteViews(context.getPackageName(),
  26. R.layout.widget);
  27. bckgrnd=BitmapFactory.decodeResource(context.getResources(), R.drawable.backgrnd);
  28. over=BitmapFactory.decodeResource(context.getResources(), R.drawable.human);
  29.  
  30. bitmap=bckgrnd.copy(Bitmap.Config.ARGB_8888, true);;
  31. Canvas c=new Canvas(bitmap);
  32. c.drawBitmap(over, 50, 50, new Paint());
  33. widgetView.setImageViewBitmap(R.id.stage, bitmap);
  34.  
  35.  
  36.  
  37. Log.d("MyLog", "onEnabled");
  38. }
  39.  
  40. ......
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement