Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

25
LINES

< > BotCompany Repo | #710 // Example: Update widget with bitmap (Android)

JavaX source code (Android) [tags: use-pretranspiled] - run with: the app

Libraryless. Click here for Pure Java version (128L/2K/5K).

!636
!standard functions // for "call"

import android.app.Activity;
import android.widget.*;
import android.graphics.*;

main {
  static Activity androidContext;
  
  psvm {
    print "Putting bitmap on widget..."
    
      int shift=new java.util.Random().nextInt();
      int w=256, h=256;
      int[] pixels = new int[w*h];
      for (int i=0; i < w*h; i++)
        pixels[i] = i+shift;

      Bitmap bitmap = Bitmap.createBitmap(pixels, w, h, Bitmap.Config.RGB_565);
    
    call(androidContext, "updateWidgetWithBitmap", bitmap);
    print "yo"
  }
}

Author comment

Began life as a copy of #1000423

download  show line numbers  debug dex  old transpilations   

Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, exkalrxbqyxc, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, mrjhfnjfopze, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #710
Snippet name: Example: Update widget with bitmap (Android)
Eternal ID of this version: #710/1
Text MD5: 13f81a79d10f32bb6fe3dbc32e827d02
Transpilation MD5: e4bc920484aaa8e63e2c800de1a2f61b
Author: stefan
Category: javax android
Type: JavaX source code (Android)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-08-05 18:13:43
Source code size: 582 bytes / 25 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 632 / 613
Referenced in: [show references]