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).

1  
!636
2  
!standard functions // for "call"
3  
4  
import android.app.Activity;
5  
import android.widget.*;
6  
import android.graphics.*;
7  
8  
main {
9  
  static Activity androidContext;
10  
  
11  
  psvm {
12  
    print "Putting bitmap on widget..."
13  
    
14  
      int shift=new java.util.Random().nextInt();
15  
      int w=256, h=256;
16  
      int[] pixels = new int[w*h];
17  
      for (int i=0; i < w*h; i++)
18  
        pixels[i] = i+shift;
19  
20  
      Bitmap bitmap = Bitmap.createBitmap(pixels, w, h, Bitmap.Config.RGB_565);
21  
    
22  
    call(androidContext, "updateWidgetWithBitmap", bitmap);
23  
    print "yo"
24  
  }
25  
}

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: 573 / 524
Referenced in: [show references]