コード例 #1
0
  public WatchlistDataset(Context context) {
    super(
        RawFileUtils.getRawAsString(context, R.raw.query_watchlist),
        DatasetType.QUERY,
        "watchlist");

    mContext = context;
  }
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstance) {
    super.onCreate(savedInstance);
    setContentView(R.layout.webview_activity);

    // adjust actionbar
    setDisplayHomeAsUpEnabled(true);

    mWebView = (WebView) findViewById(R.id.webViewContent);
    // enable javascript
    mWebView.getSettings().setJavaScriptEnabled(true);

    if (getIntent() == null) return;

    try {
      if ("android.resource".equals(getIntent().getData().getScheme())) {
        int rawId =
            Integer.parseInt(
                getIntent()
                    .getData()
                    .getPathSegments()
                    .get(getIntent().getData().getPathSegments().size() - 1));

        WebSettings settings = mWebView.getSettings();
        settings.setDefaultTextEncodingName("utf-8");
        mWebView.loadData(
            RawFileUtils.getRawAsString(getApplicationContext(), rawId),
            "text/html; charset=utf-8",
            null);
      } else {
        mWebView.loadUrl(getIntent().getData().toString());
      }
    } catch (Exception e) {
      Log.e(LOGCAT, e.getMessage());
    }
  }
コード例 #3
0
 public String getWatchlistSqlQuery() {
   String result = RawFileUtils.getRawAsString(mContext, R.raw.query_watchlist);
   return result;
 }