object list implemented
This commit is contained in:
parent
61e30dba3e
commit
adb74f8c3b
4 changed files with 18 additions and 6 deletions
|
@ -62,7 +62,6 @@ public class BucketSelect extends AppCompatActivity {
|
||||||
Img = new ArrayList<String>();
|
Img = new ArrayList<String>();
|
||||||
// Print bucket names
|
// Print bucket names
|
||||||
//System.out.println("Buckets:");
|
//System.out.println("Buckets:");
|
||||||
int i=0;
|
|
||||||
for (Bucket bucket : buckets) {
|
for (Bucket bucket : buckets) {
|
||||||
//i++;
|
//i++;
|
||||||
//System.out.println(bucket.getName());
|
//System.out.println(bucket.getName());
|
||||||
|
@ -70,7 +69,7 @@ public class BucketSelect extends AppCompatActivity {
|
||||||
//Img.add(R.drawable.ic_launcher_foreground);
|
//Img.add(R.drawable.ic_launcher_foreground);
|
||||||
Img.add(R.drawable.bucket);
|
Img.add(R.drawable.bucket);
|
||||||
}
|
}
|
||||||
System.out.println(Name);
|
//System.out.println(Name);
|
||||||
|
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,10 @@ import com.amazonaws.services.s3.AmazonS3;
|
||||||
import com.amazonaws.services.s3.AmazonS3Client;
|
import com.amazonaws.services.s3.AmazonS3Client;
|
||||||
import com.amazonaws.services.s3.S3ClientOptions;
|
import com.amazonaws.services.s3.S3ClientOptions;
|
||||||
import com.amazonaws.services.s3.model.Bucket;
|
import com.amazonaws.services.s3.model.Bucket;
|
||||||
|
import com.amazonaws.services.s3.model.ListObjectsV2Result;
|
||||||
|
import com.amazonaws.services.s3.model.ObjectListing;
|
||||||
|
import com.amazonaws.services.s3.model.S3Object;
|
||||||
|
import com.amazonaws.services.s3.model.S3ObjectSummary;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -56,20 +60,29 @@ public class ObjectSelect extends AppCompatActivity {
|
||||||
try {
|
try {
|
||||||
//Your code goes here
|
//Your code goes here
|
||||||
List<Bucket> buckets = s3client.listBuckets();
|
List<Bucket> buckets = s3client.listBuckets();
|
||||||
|
//List<S3Object> objects = (List<S3Object>) s3client.listObjects(bucket, "/");
|
||||||
|
ListObjectsV2Result result = s3client.listObjectsV2(bucket, "/");
|
||||||
|
//System.out.println(objects);
|
||||||
//This convert bucket list to an array list
|
//This convert bucket list to an array list
|
||||||
Name = new ArrayList<String>();
|
Name = new ArrayList<String>();
|
||||||
Img = new ArrayList<String>();
|
Img = new ArrayList<String>();
|
||||||
// Print bucket names
|
// Print bucket names
|
||||||
//System.out.println("Buckets:");
|
//System.out.println("Buckets:");
|
||||||
int i=0;
|
int i=0;
|
||||||
for (Bucket bucket : buckets) {
|
List<S3ObjectSummary> objects = result.getObjectSummaries();
|
||||||
|
for (S3ObjectSummary os : objects) {
|
||||||
|
Name.add(os.getKey());
|
||||||
|
Img.add(R.drawable.videofile);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*for (Bucket bucket : buckets) {
|
||||||
//i++;
|
//i++;
|
||||||
//System.out.println(bucket.getName());
|
//System.out.println(bucket.getName());
|
||||||
Name.add(bucket.getName());
|
Name.add(bucket.getName());
|
||||||
//Img.add(R.drawable.ic_launcher_foreground);
|
//Img.add(R.drawable.ic_launcher_foreground);
|
||||||
Img.add(R.drawable.bucket);
|
Img.add(R.drawable.videofile);
|
||||||
}
|
}*/
|
||||||
System.out.println(Name);
|
//System.out.println(Name);
|
||||||
|
|
||||||
runOnUiThread(new Runnable() {
|
runOnUiThread(new Runnable() {
|
||||||
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 19 KiB |
BIN
app/src/main/res/drawable/videofile.png
Normal file
BIN
app/src/main/res/drawable/videofile.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
Loading…
Reference in a new issue