Ejemplo n.º 1
0
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   switch (requestCode) {
     case (Constants.LOGIN_RESULTCODE):
       {
         if (resultCode == Activity.RESULT_OK) {
           String verifier = data.getStringExtra(Constants.LOGIN_VERIFIER);
           helper.setVerifier(verifier);
           // TODO Switch tabs using the index.
         }
         break;
       }
     case (Constants.CATEGORY_RESULTCODE):
       {
         String currentCategory = data.getStringExtra(Constants.CATEGORY_RESULT);
         currentCategoryNumber = data.getStringExtra(Constants.CATEGORYNUMBER_RESULT);
         Toast.makeText(
                 this.getApplicationContext(),
                 "You selected: " + currentCategory,
                 Toast.LENGTH_LONG)
             .show();
         break;
       }
   }
 }
Ejemplo n.º 2
0
        public void run() {
          File cachegories = TrademeHelper.getJSON(Constants.CATEGORIES_URL, false);

          FileReader fRead = null;
          try {
            fRead = new FileReader(cachegories);

          } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }

          Gson gson = new Gson();
          helper.setCategories(gson.fromJson(fRead, Category.class));
          try {
            fRead.close();
          } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        }