日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

app开发历程——android手机显示服务器端图片思路

發(fā)布時間:2023/12/31 综合教程 26 生活家
生活随笔 收集整理的這篇文章主要介紹了 app开发历程——android手机显示服务器端图片思路 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

以前自己都不知道怎么去顯示服務(wù)器端的圖片,還好在apkbus論壇上找到一個特別簡單的例子。雖然一天天忙忙碌碌,但是自己內(nèi)心其實有一種想逃的心里,說不定哪天就會冒出來。

1、首先服務(wù)器端圖片

這里的ImageServlet.java,沒有做相關(guān)處理

這里啟動tomcat,這時在瀏覽器中輸入http://localhost:8080/ReadImage1/image/a.jpg

這時應(yīng)該能看到這張圖片。

2、android程序

布局文件:

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 3     android:layout_width="fill_parent"
 4     android:layout_height="fill_parent"
 5     android:orientation="vertical" >
 6 
 7 
 8         <TextView
 9             android:layout_width="wrap_content"
10             android:layout_height="wrap_content"
11             android:text="網(wǎng)路圖片地址" />
12 
13         <EditText
14             android:id="@+id/editText"
15             android:layout_width="fill_parent"
16             android:layout_height="wrap_content"
17         
18             android:text="http://192.168.0.121:8081/ReadImage1/image/" />
19 
20         <Button
21             android:id="@+id/button1"
22             android:layout_width="wrap_content"
23             android:layout_height="wrap_content"
24             android:text="顯示" />
25 
26 
27     <WebView
28         android:id="@+id/webView"
29         android:layout_width="wrap_content"
30         android:layout_height="wrap_content" />
31 
32 </LinearLayout>

相關(guān)后臺代碼

package com.haofs.demo;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.EditText;

public class ImageClientActivity extends Activity implements OnClickListener {
    private Button button;
    private EditText editText;
    private WebView webView;

    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        button = (Button) findViewById(R.id.button1);
        editText = (EditText) findViewById(R.id.editText);
        webView = (WebView) findViewById(R.id.webView);

        button.setOnClickListener(this);
    }

    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        webView.loadUrl(editText.getText().toString());
    }
}

本文來自:

從Android客戶端加載服務(wù)端的圖片
http://www.apkbus.com/forum.php?mod=viewthread&tid=97293
(出處: Android開發(fā)論壇 - 安卓開發(fā)論壇 - Android開發(fā) - 安卓論壇 - 移動互聯(lián)網(wǎng)門戶)

生活的一步一步,思想的一寸一寸,無時無刻......

總結(jié)

以上是生活随笔為你收集整理的app开发历程——android手机显示服务器端图片思路的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。