ObjectBrowserpublic 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 |
Methods Summary |
---|
protected void | onCreate(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 void | onDestroy()
unregisterReceiver(mDisconnectedReceiver);
super.onDestroy();
| protected void | onListItemClick(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 void | onResume()
super.onResume();
mObjectList = mClient.getObjectList(mDeviceName, mStorageID, mObjectID);
setListAdapter(new ObjectAdapter(this));
|
|