异世界百科APP



  • 当前版本:20.2.1Beta

    下载地址:

    Android 6.0以上:点击下载

    Android 6.0 以下的设备建议使用Firefox/Chrome访问此异世界百科。

    更新记录:

    Beta

    • 比网页版更快的打开速度

    20.2.1Beta

    • 进一步优化打开速度(使用中国大陆-浙江节点)
    • 优化闪退
    private final String TAG = "MainActivity";
    private String mBaseUrl = "http://isekai.cn/";
    private OkHttpClient mHttpClient = new OkHttpClient();
    private Handler mHandler = new Handler();
    private TextView tv;
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tv = (TextView) findViewById(R.id.tv);
        }
    
    public void onGet(View view) {
      private OkHttpClient mHttpClient = new OkHttpClient();
      final Request request = new Request
                      .Builder()
                      .get()
                      .url(mBaseUrl+"login?username=test&password=1234")
                      .build();
      final Call call = mHttpClient.newCall(request);
      call.enqueue(new Callback() {
         @Override
         public void onFailure(Request request, IOException e) {
             Log.e(TAG, "onFailure");
             e.printStackTrace();
          }
    
          @Override
          public void onResponse(Response response) throws IOException {
              Log.e(TAG, "onResponse");
              if (response.isSuccessful()) {
                  final String res = response.body().string();
                  runOnUiThread(new Runnable() {
                     @Override
                     public void run() {
                         tv.setText(res);
                     }
                   });
                }
          }
      });
    }
    

登录后回复