Ejemplo n.º 1
0
    @Override
    protected String doInBackground(Void... params) {
      Activity activity = getActivity();
      List<TranslationItem> translationItems = null;
      if (activity instanceof PagerActivity) {
        translationItems = ((PagerActivity) activity).getTranslations();
      }

      String db = TranslationUtils.getDefaultTranslation(activity, translationItems);

      if (db != null) {
        try {
          DatabaseHandler tafsirHandler = new DatabaseHandler(getActivity(), db);
          Cursor cursor = tafsirHandler.getVerse(sura, ayah);
          if (cursor.moveToFirst()) {
            String text = cursor.getString(2);
            cursor.close();
            tafsirHandler.closeDatabase();
            return text;
          }
        } catch (Exception e) {
        }
      }
      return null;
    }
Ejemplo n.º 2
0
    @Override
    protected String doInBackground(Void... params) {
      String text = null;
      try {
        DatabaseHandler ayahHandler =
            new DatabaseHandler(getActivity(), QuranDataProvider.QURAN_ARABIC_DATABASE);
        Cursor cursor =
            ayahHandler.getVerses(sura, ayah, sura, ayah, DatabaseHandler.ARABIC_TEXT_TABLE);
        if (cursor.moveToFirst()) {
          text = cursor.getString(2);
        }
        cursor.close();
        ayahHandler.closeDatabase();
      } catch (Exception e) {
      }

      return text;
    }