diff --git a/android/src/com/retroarch/fileio/FileChooser.java b/android/src/com/retroarch/fileio/FileChooser.java index ffc254b5be..34476b031c 100644 --- a/android/src/com/retroarch/fileio/FileChooser.java +++ b/android/src/com/retroarch/fileio/FileChooser.java @@ -232,18 +232,10 @@ public class FileChooser extends Activity Toast.makeText(this, "Loading: "+o.getName() + "...", Toast.LENGTH_SHORT).show(); Intent intent=new Intent(); - intent.putExtra(FileChooser.PAYLOAD_FILENAME, o.getPath()); - setResult(RESULT_OK, intent); - - rruntime.settings_set_defaults(); - rruntime.load_game(o.getPath(), 0); - - Uri video = Uri.parse("android.resource://" + getPackageName() + "/" - + R.raw.retroarch); - - rruntime.startup(video.toString()); - - finish(); + intent.putExtra("PATH", o.getPath()); + intent.putExtra("NAME", o.getName()); + setResult(RESULT_OK, intent); + finish(); } @Override diff --git a/android/src/com/retroarch/main.java b/android/src/com/retroarch/main.java index c64825c0a0..9fe3c917c9 100644 --- a/android/src/com/retroarch/main.java +++ b/android/src/com/retroarch/main.java @@ -26,11 +26,14 @@ import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.Toast; +import android.net.Uri; import android.opengl.GLSurfaceView; import android.os.Bundle; public class main extends Activity { + static private final int ACTIVITY_LOAD_ROM = 0; + private GLSurfaceView ctx_gl; @Override @@ -60,7 +63,7 @@ public class main extends Activity case R.id.open: Toast.makeText(this, "Select a ROM image from the Filebrowser.", Toast.LENGTH_SHORT).show(); Intent myIntent = new Intent(main.this, FileChooser.class); - main.this.startActivity(myIntent); + startActivityForResult(myIntent, ACTIVITY_LOAD_ROM); break; default: Toast.makeText(this, "MenuItem " + item.getTitle() + " selected.", Toast.LENGTH_SHORT).show(); @@ -70,6 +73,20 @@ public class main extends Activity return true; } + protected void onActivityResult(int requestCode, int resultCode, Intent data) + { + if(requestCode == ACTIVITY_LOAD_ROM) + { + rruntime.settings_set_defaults(); + rruntime.load_game(data.getStringExtra("PATH"), 0); + + Uri video = Uri.parse("android.resource://" + getPackageName() + "/" + + R.raw.retroarch); + + rruntime.startup(video.toString()); + } + } + @Override protected void onPause() {