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

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

Issue 11467028: Migrate files to embedder. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review fixes Created 7 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/android_sample/jni/vm_glue.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/android_sample/src/com/google/dartndk/DummyActivity.java
diff --git a/samples/android_sample/src/com/google/dartndk/DummyActivity.java b/samples/android_sample/src/com/google/dartndk/DummyActivity.java
index 3eb3b7b952f101780187f48ff82c09effd4ea143..5d9d91f2f1d4426a0aa03688457c39ba14ad9041 100644
--- a/samples/android_sample/src/com/google/dartndk/DummyActivity.java
+++ b/samples/android_sample/src/com/google/dartndk/DummyActivity.java
@@ -13,29 +13,30 @@ import android.util.Log;
public class DummyActivity extends NativeActivity {
static {
+ // TODO(vsm): We should be able to get rid of this here
+ // and specify in xml instead.
System.loadLibrary("android_embedder");
- System.loadLibrary("DartNDK");
}
-
+
@Override
public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- try {
+ super.onCreate(savedInstanceState);
+ try {
File localDir = getApplicationContext().getDir("dart", 0);
String fileSystemPath = localDir.toString();
String assetPath = "dart";
AssetManager assetManager = getAssets();
String[] files = assetManager.list(assetPath);
byte[] buffer = new byte[1024];
- int read;
+ int read;
for (String filename : files) {
String dest = fileSystemPath + "/" + filename;
- Log.w("Dart", "Copying " + dest);
+ Log.w("Dart", "Copying " + dest);
InputStream in = assetManager.open(assetPath + "/" + filename);
OutputStream out = new FileOutputStream(dest);
while((read = in.read(buffer)) != -1){
out.write(buffer, 0, read);
- }
+ }
in.close();
out.flush();
((FileOutputStream)out).getFD().sync();
« no previous file with comments | « samples/android_sample/jni/vm_glue.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698