GUI; mobile file dialog improvements
This commit is contained in:
parent
dc7aec2dc1
commit
4e88a677d0
9 changed files with 60 additions and 22 deletions
|
|
@ -1,25 +1,29 @@
|
|||
package org.tildearrow.furnace;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.libsdl.app.SDLActivity;
|
||||
|
||||
public class MainActivity extends SDLActivity {
|
||||
static final int TA_FILE_REQUEST=1000;
|
||||
|
||||
public boolean showFileDialog() {
|
||||
public void showFileDialog() {
|
||||
Intent picker=new Intent(Intent.ACTION_GET_CONTENT);
|
||||
picker.setType("*/*");
|
||||
picker=Intent.createChooser(picker,"test");
|
||||
startActivityForResult(picker,TA_FILE_REQUEST);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override protected void onActivityResult(int request, int result, Intent intent) {
|
||||
super.onActivityResult(request,result,intent);
|
||||
if (request==TA_FILE_REQUEST) {
|
||||
// TODO: fire an event here
|
||||
if (result==RESULT_OK) {
|
||||
Context context=getApplicationContext();
|
||||
Toast toast=Toast.makeText(context,"Got a file",Toast.LENGTH_SHORT);
|
||||
toast.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue