@Override
  public boolean onOptionsItemSelected(MenuItem item) {

    boolean res = false;

    switch (item.getItemId()) {
      case R.id.menu_about_app: // アプリについて
        Intent intent = new Intent(getApplicationContext(), AboutAppActivity.class);
        intent.putExtra("url", MyHttpClient.getHostName(getApplicationContext()) + "/app/about/");
        startActivity(intent);
        res = true;
        break;
      case R.id.menu_about_map: // マップについて
        startActivity(new Intent(getApplicationContext(), AboutMapActivity.class));
        res = true;
        break;
      default:
        break;
    }

    return res;
  }
Beispiel #2
0
    @Override
    public boolean onSuccess(HttpResponse response, RequestInfo reqInfo) {
      String startTag = null;
      String key = null;

      String xml = MyHttpClient.getString(MyHttpClient.getInputStream(response));

      XmlPullParser parser = Xml.newPullParser();
      try {
        parser.setInput(new StringReader(xml));

        int eventType = parser.getEventType();
        Utility.log(context, "eventType:" + eventType);
        while (eventType != XmlPullParser.END_DOCUMENT) {
          switch (eventType) {
            case XmlPullParser.START_DOCUMENT:
              // Utility.log(this, "START_DOCUMENT");
              break;
            case XmlPullParser.END_DOCUMENT:
              // Utility.log(this, "END_DOCUMENT");
              break;
            case XmlPullParser.START_TAG:
              // Utility.log(this, "START_TAG");
              key = parser.getName();
              Utility.log(context, "key:" + key);
              startTag = key;
              break;
            case XmlPullParser.END_TAG:
              // Utility.log(this, "END_TAG");
              break;
            case XmlPullParser.TEXT:
              // Utility.log(this, "TEXT");
              if (key != null) {
                String value = parser.getText();
                Utility.log(context, "value:" + value);

                if (key.equals("Version")) {
                  version = value;
                } else if (key.equals("Result")) {
                  if (value.trim().equals("OK")) {
                    result = 1;
                  } else {
                    result = Integer.valueOf(value.trim());
                  }
                } else if (key.equals("Uid")) {
                  uid = value;
                }
              }
              key = null;
              break;
          }
          eventType = parser.next();
        }

      } catch (Exception e) {
        e.printStackTrace();
        return false;
      }

      return true;
    }
Beispiel #3
0
    @Override
    public boolean onSuccess(HttpResponse response, RequestInfo reqInfo) {
      items = new ArrayList<Gc>();
      Gc gc = new Gc();
      String startTag = null;
      String key = null;

      String xml = MyHttpClient.getString(MyHttpClient.getInputStream(response));

      Utility.log(context, xml);
      XmlPullParser parser = Xml.newPullParser();
      try {
        parser.setInput(new StringReader(xml));

        int eventType = parser.getEventType();
        Utility.log(context, "eventType:" + eventType);
        while (eventType != XmlPullParser.END_DOCUMENT) {
          switch (eventType) {
            case XmlPullParser.START_DOCUMENT:
              // Utility.log(this, "START_DOCUMENT");
              break;
            case XmlPullParser.END_DOCUMENT:
              // Utility.log(this, "END_DOCUMENT");
              break;
            case XmlPullParser.START_TAG:
              // Utility.log(this, "START_TAG");
              key = parser.getName();
              // Utility.log(this, "key:" + key);
              if (key.compareTo("Item") == 0) {
                startTag = key;
                gc = new Gc();
              } else if (key.compareTo("GetGcid") == 0) {
                startTag = key;
              }
              break;
            case XmlPullParser.END_TAG:
              // Utility.log(this, "END_TAG");
              if (parser.getName().compareTo("Item") == 0) {
                items.add(gc);
              }
              break;
            case XmlPullParser.TEXT:
              // Utility.log(this, "TEXT");
              if (key != null) {
                String value = parser.getText();
                if (startTag.equals("GetGcid")) {
                  if (key.equals("Version")) {
                    resultInfo.version = value;
                  } else if (key.equals("Status")) {
                    resultInfo.status = Boolean.valueOf(value);
                  }
                } else {
                  gc.setField(key, value);
                }
              }
              key = null;
              break;
          }
          eventType = parser.next();
        }
      } catch (Exception e) {
        e.printStackTrace();
      }

      return false;
    }