InfoActivity.java
Go to the documentation of this file.
1 package com.intel.realsense.camera;
2 
3 import android.os.Bundle;
4 import androidx.appcompat.app.AppCompatActivity;
5 import android.util.Log;
6 import android.widget.ArrayAdapter;
7 import android.widget.ListView;
8 import android.widget.TextView;
9 
14 
15 import java.util.Map;
16 import java.util.TreeMap;
17 
18 public class InfoActivity extends AppCompatActivity {
19  private static final String TAG = "librs camera info";
20 
21  @Override
22  protected void onCreate(Bundle savedInstanceState) {
23  super.onCreate(savedInstanceState);
24  setContentView(R.layout.activity_list_view);
25  }
26 
27  @Override
28  protected void onResume() {
29  super.onResume();
30 
31  TextView message = findViewById(R.id.list_view_title);
32 
33  Map<CameraInfo,String> infoMap = new TreeMap<>();
34 
35  RsContext ctx = new RsContext();
36  try(DeviceList devices = ctx.queryDevices()){
37  if(devices.getDeviceCount() == 0){
38  finish();
39  }
40  message.setText("Device info:");
41 
42  try(final Device device = devices.createDevice(0)){
43  if(device == null){
44  Log.e(TAG, "failed to create device");
45  return;
46  }
47  for(CameraInfo ci : CameraInfo.values()){
48  if(device.supportsInfo(ci))
49  infoMap.put(ci, device.getInfo(ci));
50  }
51  }
52  }
53 
54  final String[] info = new String[infoMap.size()];
55  int i = 0;
56  for(Map.Entry e : infoMap.entrySet()){
57  info[i++] = e.getKey().toString() + ": " + e.getValue();
58  }
59 
60  final ListView listview = findViewById(R.id.list_view);
61 
62  final ArrayAdapter adapter = new ArrayAdapter<>(this, R.layout.files_list_view, info);
63  listview.setAdapter(adapter);
64  }
65 }
GLenum GLuint GLenum GLsizei const GLchar * message
::rosgraph_msgs::Log_< std::allocator< void > > Log
Definition: Log.h:88
uvc_xu_option< int > super
Definition: l500-options.h:32
e
Definition: rmse.py:177
::std_msgs::String_< std::allocator< void > > String
Definition: String.h:47
def info(name, value, persistent=False)
Definition: test.py:301
devices
Definition: test-fg.py:9
def finish()
Definition: test.py:373
void onCreate(Bundle savedInstanceState)
int i
auto device
Definition: pyrs_net.cpp:17


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:17