Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: samples/android_sample/src/com/google/dartndk/DummyActivity.java

Issue 11434046: Android rayshader sample. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/android_sample/res/values/styles.xml ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 package com.google.dartndk;
2
3 import java.io.File;
4 import java.io.FileOutputStream;
5 import java.io.InputStream;
6 import java.io.IOException;
7 import java.io.OutputStream;
8
9 import android.app.NativeActivity;
10 import android.content.res.AssetManager;
11 import android.os.Bundle;
12 import android.util.Log;
13
14 public class DummyActivity extends NativeActivity {
15 static {
16 System.loadLibrary("android_embedder");
17 System.loadLibrary("DartNDK");
18 }
19
20 @Override
21 public void onCreate(Bundle savedInstanceState) {
22 super.onCreate(savedInstanceState);
23 try {
24 File localDir = getApplicationContext().getDir("dart", 0);
25 String fileSystemPath = localDir.toString();
26 String assetPath = "dart";
27 AssetManager assetManager = getAssets();
28 String[] files = assetManager.list(assetPath);
29 byte[] buffer = new byte[1024];
30 int read;
31 for (String filename : files) {
32 String dest = fileSystemPath + "/" + filename;
33 Log.w("Dart", "Copying " + dest);
34 InputStream in = assetManager.open(assetPath + "/" + filename);
35 OutputStream out = new FileOutputStream(dest);
36 while((read = in.read(buffer)) != -1){
37 out.write(buffer, 0, read);
38 }
39 in.close();
40 out.flush();
41 ((FileOutputStream)out).getFD().sync();
42 out.close();
43 }
44 } catch (IOException ex) {
45 }
46 }
47 }
OLDNEW
« no previous file with comments | « samples/android_sample/res/values/styles.xml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698