title: Fetch data from SQLite only contains single data row
body: <p>In my app i am <strong>storing data to SQLite</strong>, and now i am trying to <strong>fetch that data from SQLite to activity</strong>.</p>
  
  <p>as per requirement i just have to store single data at a time and my table will contain only single data row not more than one row.</p>
  
  <p>so I want if table has data row then <strong>fetch data and show in form</strong> in <strong>onCreate(..)</strong> of <strong>LoginActivity.java</strong></p>
  
  <p><strong>Getting:</strong></p>
  
  <pre><code>The method SelectData(String) in the type myDBClass is not applicable for the arguments ()
  </code></pre>
  
  <p><strong>myDBClass.java:</strong></p>
  
  <pre><code>// Select Data
      public String[] SelectData(String strOperatorID) {
          // TODO Auto-generated method stub
  
           try {
              String arrData[] = null;    
  
               SQLiteDatabase db;
               db = this.getReadableDatabase(); // Read Data
  
               Cursor cursor = db.query(TABLE_NAME, new String[] { "*" }, 
                          "OperatorID=?",
                          new String[] { String.valueOf(strOperatorID) }, null, null, null, null);
  
                  if(cursor != null)
                  {
                      if (cursor.moveToFirst()) {
                          arrData = new String[cursor.getColumnCount()];
  
                          arrData[0] = cursor.getString(0); // DeviceID
                          arrData[1] = cursor.getString(1); // EmailID
                          arrData[2] = cursor.getString(2); // Event
                          arrData[3] = cursor.getString(3); // Operator
                          arrData[4] = cursor.getString(4); // EventOperator
                      }
                  }
  
                  cursor.close();
                  db.close();
                  return arrData;
  
           } catch (Exception e) {
              return null;
           }
      }
  </code></pre>
  
  <p><strong>LoginActivity.java:-</strong></p>
  
  <pre><code>public class LoginActivity extends Activity  {
      .................
  
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
          setContentView(R.layout.activity_login);
  
          btnLogout = (Button) findViewById(R.id.btnLogout);
          btnCamera = (Button) findViewById(R.id.btnCamera);
          btnGallery = (Button) findViewById(R.id.btnGallery);
  
              txtDeviceID = (TextView) findViewById(R.id.txtDeviceID);
              txtEmailID = (TextView) findViewById(R.id.txtEmailID);      
              txtEvent = (TextView) findViewById(R.id.txtEvent);  
              txtOperative = (TextView) findViewById(R.id.txtOperative);
              txtEventOperator = (TextView) findViewById(R.id.txtEventOperator);
  
               Intent intent = getIntent();
               deviceID = intent.getStringExtra("deviceID");
               emailID = intent.getStringExtra("emailID");
               event = intent.getStringExtra("name"); 
               operative = intent.getStringExtra("firstName");
  
               txtDeviceID.setText(deviceID);
               txtEmailID.setText(emailID);
               txtEvent.setText(event);
               txtOperative.setText(operative);
               txtEventOperator.setText(event + "  " + operative);
  
               strEvent = txtEvent.getText().toString();
               strOperative = txtOperative.getText().toString();
  
                  // Dialog
                  final AlertDialog.Builder adb = new AlertDialog.Builder(this);
                  AlertDialog ad = adb.create();
  
                  // new Class DB
                  final myDBClass myDb = new myDBClass(this);
  
                  // Save Data
                  long saveStatus = myDb.InsertData(
                              txtDeviceID.getText().toString(),
                              txtEmailID.getText().toString(),
                              txtEvent.getText().toString(),
                              txtOperative.getText().toString(),
                              txtEventOperator.getText().toString()
                              );
  
                  if(saveStatus &lt;=  0)
                  {
                    ad.setMessage("Error!! ");
                    ad.show();
                    return;
                  }   
  
                  // Show Data
                  String arrData[] = myDb.SelectData();
                  if(arrData != null)
                  {
                      txtDeviceID.setText(arrData[1]);
                      txtEmailID.setText(arrData[2]);
                      txtEvent.setText(arrData[3]);
                      txtOperative.setText(arrData[4]);
                      txtEventOperator.setText(arrData[5]);
                  }  
  
   if(txtEvent.getText().toString().equals("") &amp;&amp; txtOperative.getText().toString().equals(""))
                  {
                      Intent intentCall = new Intent(LoginActivity.this, LicenseListActivity.class);
                      startActivity(intentCall);
                  }
                }
  </code></pre>