FileDocCategorySizeDatePackage
ObjectBrowser.javaAPI DocAndroid 5.1 API4928Thu Mar 12 22:22:30 GMT 2015com.android.camerabrowser

ObjectBrowser

public class ObjectBrowser extends android.app.ListActivity
A list view displaying all objects within a container (folder or storage unit).

Fields Summary
private static final String
TAG
private MtpClient
mClient
private List
mObjectList
private String
mDeviceName
private int
mStorageID
private int
mObjectID
private DeviceDisconnectedReceiver
mDisconnectedReceiver
Constructors Summary
Methods Summary
protected voidonCreate(android.os.Bundle savedInstanceState)

        super.onCreate(savedInstanceState);

        mClient = ((CameraBrowserApplication)getApplication()).getMtpClient();
        mDeviceName = getIntent().getStringExtra("device");
        mStorageID = getIntent().getIntExtra("storage", 0);
        mObjectID = getIntent().getIntExtra("object", 0);
        mDisconnectedReceiver = new DeviceDisconnectedReceiver(this, mDeviceName);
    
protected voidonDestroy()

        unregisterReceiver(mDisconnectedReceiver);
        super.onDestroy();
    
protected voidonListItemClick(android.widget.ListView l, android.view.View v, int position, long id)

        MtpObjectInfo info = mObjectList.get(position);
        Intent intent;
        if (info.getFormat() == MtpConstants.FORMAT_ASSOCIATION) {
            intent = new Intent(this, ObjectBrowser.class);
        } else {
            intent = new Intent(this, ObjectViewer.class);
        }
        intent.putExtra("device", mDeviceName);
        intent.putExtra("storage", mStorageID);
        intent.putExtra("object", info.getObjectHandle());
        startActivity(intent);
    
protected voidonResume()

        super.onResume();

        mObjectList = mClient.getObjectList(mDeviceName, mStorageID, mObjectID);
        setListAdapter(new ObjectAdapter(this));