Add the sample of adding query content in intent
Add the query content in intent Bug: 119866469 Test: manually using ApiDemos Content > Storage > Documents Change-Id: I97ccd1ca6d3e1ecbddefe353b625c145d4c0ecd0
This commit is contained in:
@@ -206,6 +206,26 @@ public class DocumentsSample extends Activity {
|
||||
});
|
||||
view.addView(button);
|
||||
|
||||
button = new Button(context);
|
||||
button.setText("GET_CONTENT */* with content query \"FILE\"");
|
||||
button.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
|
||||
intent.addCategory(Intent.CATEGORY_OPENABLE);
|
||||
intent.setType("*/*");
|
||||
intent.putExtra(Intent.EXTRA_CONTENT_QUERY, "FILE");
|
||||
if (multiple.isChecked()) {
|
||||
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
|
||||
}
|
||||
if (localOnly.isChecked()) {
|
||||
intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true);
|
||||
}
|
||||
startActivityForResult(Intent.createChooser(intent, "Kittens!"), CODE_READ);
|
||||
}
|
||||
});
|
||||
view.addView(button);
|
||||
|
||||
button = new Button(context);
|
||||
button.setText("OPEN_DOC_TREE");
|
||||
button.setOnClickListener(new OnClickListener() {
|
||||
|
||||
Reference in New Issue
Block a user