title: How to get getitem if found or not Dynamodb in Android
body: <p>I am having an issue with my Android code where I am reading from Dynamodb using the SDK I want to read an Item using getItem which works but I want to do it if Item is found make a Toast msg "Item is found" and if not found with a toast msg "no item found. in the DynamoDBManager class the file is ok somehow I need to get that info in my Activity class</p>
  
  <pre><code>public static WinTicket getTicketByBarcode(String barcodeNumber) {
  
      AmazonDynamoDBClient ddb = Barca.clientManager.ddb();
      DynamoDBMapper mapper = new DynamoDBMapper(ddb);
  
      try {
          WinTicket winTicket = mapper.load(WinTicket.class,
                  barcodeNumber);
  
          if(winTicket == null){
  
             String awo = "false" ;
              Log.e(TAG,"NOT FOUND");
              // No item found
          }
          else{
  
              String awo = "true" ;
  
              Log.e(TAG,"YES FILE IN DATABASE");
  
              // Item is found in database
          }
  
  
  
  
  
  
  
          return winTicket;
  
      } catch (AmazonServiceException ex) {
          Barca.clientManager.wipeCredentialsOnAuthError(ex);
      }
  
      return null;
  }
  </code></pre>
  
  <p>the above code is DynamodbManager class</p>
  
  <p>the one under here is from the Barca Activity class
  I think in the Activity file I need to make some edit I dont know what but I sure its in the private class DynamoDBManagerTask or protected void onPostExecute</p>
  
  <pre><code>private class DynamoDBManagerTask extends
          AsyncTask&lt;DynamoDBManagerType, Void, DynamoDBManagerTaskResult&gt; {
  
      protected DynamoDBManagerTaskResult doInBackground(
              DynamoDBManagerType... types) {
  
          DynamoDBManagerTaskResult result = new DynamoDBManagerTaskResult();
  
          result.setTaskType(types[0]);
  
          if (types[0] == DynamoDBManagerType.GET_BARCODE) {
  
              user = DynamoDBManager.getTicketByBarcode(winnum);
              Log.e(TAG,winnum);
  
  
          }
  
          return result;
      }
  
      protected void onPostExecute(DynamoDBManagerTaskResult result) {
          //  pdia.dismiss();
  
          if (result.getTaskType() == DynamoDBManagerType.GET_BARCODE) {
  
              if (datafound.equalsIgnoreCase("true")) {
                  Log.e(TAG,datafound);
  
  
                  Toast.makeText(Barca.this, "Item found",
                          Toast.LENGTH_SHORT).show();
  
              }
  
           else if (datafound.equalsIgnoreCase("false")){
                  Log.e(TAG,datafound);
  
  
                  Toast.makeText(
                      Barca.this,
                      "Sorry no Item found",
                      Toast.LENGTH_SHORT).show();
  
          }
      }
      }
  }
  </code></pre>