android studio连接web报错?

1.问题描述
可以通过浏览器连接web应用,但用android studio连接报错
2.代码如下
Android端
activity_main.xml:
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <EditText
        android:id="@+id/et_username"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="请输入用户名 " />

    <EditText
        android:id="@+id/et_password"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="请输入密码" />
    <Button
        android:onClick="click1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="get"/>
    <Button
        android:onClick="click2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="post"/>

</LinearLayout>


MainActivity

private EditText username;
private EditText password;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    username = (EditText) findViewById(R.id.et_username);
    password = (EditText) findViewById(R.id.et_password);
}

public void click1(View v) {

    new Thread() {
        @Override
        public void run() {
            super.run();
        }
    }.start();
    try {
        String name = username.getText().toString().trim();
        String pwd = password.getText().toString().trim();

        String path = "http://10.0.2.2:8080/login/loginServlet?username=" + name + "&password=" + pwd + "";

        URL url = new URL(path);
        HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");
        conn.setConnectTimeout(5000);
        int code = conn.getResponseCode();
        if (code == 200) {
            showToast("连接成功");

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

}

public void click2(View v) {

}

public void showToast(final String content) {

    runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Toast.makeText(getApplicationContext(), content, Toast.LENGTH_LONG).show();
        }
    });
}

}


AndroidManifest.xml
package="com.example.administrator.myapplication1">

<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>


点击按钮后的日志
05-01 04:50:39.613 9826-9826/? I/art: Not late-enabling -Xcheck:jni (already on)
05-01 04:50:39.613 9826-9826/? W/art: Unexpected CPU variant for X86 using defaults: x86
05-01 04:50:39.911 9826-9826/com.example.administrator.myapplication1 W/System: ClassLoader referenced unknown path: /data/app/com.example.administrator.myapplication1-2/lib/x86
05-01 04:50:39.933 9826-9826/com.example.administrator.myapplication1 I/InstantRun: starting instant run server: is main process
05-01 04:50:40.140 9826-9826/com.example.administrator.myapplication1 W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
05-01 04:50:40.727 9826-9852/com.example.administrator.myapplication1 I/OpenGLRenderer: Initialized EGL, version 1.4
05-01 04:50:40.727 9826-9852/com.example.administrator.myapplication1 D/OpenGLRenderer: Swap behavior 1
05-01 04:50:40.727 9826-9852/com.example.administrator.myapplication1 W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
05-01 04:50:40.727 9826-9852/com.example.administrator.myapplication1 D/OpenGLRenderer: Swap behavior 0
05-01 04:50:40.896 9826-9826/com.example.administrator.myapplication1 W/art: Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView
05-01 04:51:59.575 9826-9826/com.example.administrator.myapplication1 W/IInputConnectionWrapper: finishComposingText on inactive InputConnection
05-01 04:52:02.649 9826-9826/com.example.administrator.myapplication1 D/NetworkSecurityConfig: No Network Security Config specified, using platform default
05-01 04:52:02.651 9826-9826/com.example.administrator.myapplication1 W/System.err: android.os.NetworkOnMainThreadException
at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1303)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:333)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:196)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:178)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:356)
05-01 04:52:02.652 9826-9826/com.example.administrator.myapplication1 W/System.err: at java.net.Socket.connect(Socket.java:605)
at com.android.okhttp.internal.Platform.connectSocket(Platform.java:113)
at com.android.okhttp.Connection.connectSocket(Connection.java:196)
at com.android.okhttp.Connection.connect(Connection.java:172)
at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:367)
at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:130)
at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:329)
at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:246)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:457)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:405)
at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:521)
at com.example.administrator.myapplication1.MainActivity.click1(MainActivity.java:44)
at java.lang.reflect.Method.invoke(Native Method)
at android.support.v7.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:288)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
05-01 04:52:02.655 9826-9826/com.example.administrator.myapplication1 W/System.err: at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

weixin_42507854
weixin_42507854 请问怎么解决的,我也遇到了同样的错误
大约 2 个月之前 回复
weixin_41342686
weixin_41342686 回复weixin_41342686: 错误解决了,功夫不负有心人
大约一年之前 回复
weixin_41342686
weixin_41342686 在线等
大约一年之前 回复

1个回答

进入电脑的设备管理,显示android这个设备是黄色感叹号,证明驱动有问题,点击详情是:

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Androidstudio建的第一个项目报错

自学Android一个hello word困扰我好几天,以前是学web端的想转Android,结果建的项目一直报红,以为是jdk包和sdk包的问题结果重新安装配置都没用,看下面截图,哪位大神知道这是什么情况吗 ![图片说明](https://img-ask.csdn.net/upload/201906/17/1560758897_14901.png) ![图片说明](https://img-ask.csdn.net/upload/201906/17/1560758916_556617.png)

【大神求组】eclipse项目导入Androidstudio报错

![图片说明](https://img-ask.csdn.net/upload/201606/13/1465795548_265211.png) 我用的Androidstudio版本是2.1.2,导入eclipse项目之后出现在图片中的问题。 Event Log里面显示的是: 12:50:06 Executing tasks: [clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources] 12:50:13 Gradle build finished with 1 error(s) in 6s 549ms 下面是导入后生成的IMPORT SUMMARY: ``` ECLIPSE ANDROID PROJECT IMPORT SUMMARY ====================================== Ignored Files: -------------- The following files were *not* copied into the new Gradle project; you should evaluate whether these are still needed in your project and if so manually move them: * ic_launcher-web.png * proguard-project.txt Replaced Jars with Dependencies: -------------------------------- The importer recognized the following .jar files as third party libraries and replaced them with Gradle dependencies instead. This has the advantage that more explicit version information is known, and the libraries can be updated automatically. However, it is possible that the .jar file in your project was of an older version than the dependency we picked, which could render the project not compileable. You can disable the jar replacement in the import wizard and try again: android-support-v4.jar => com.android.support:support-v4:18.0.0 gson-2.2.4.jar => com.google.code.gson:gson:2.2.4 Potentially Missing Dependency: ------------------------------- When we replaced the following .jar files with a Gradle dependency, we inferred the dependency version number from the filename. This specific version may not actually be available from the repository. If you get a build error stating that the dependency is missing, edit the version number to for example "+" to pick up the latest version instead. (This may require you to update your code if the library APIs have changed.) gson-2.2.4.jar => version 2.2.4 in com.google.code.gson:gson:2.2.4 Moved Files: ------------ Android Gradle projects use a different directory structure than ADT Eclipse projects. Here's how the projects were restructured: * AndroidManifest.xml => app\src\main\AndroidManifest.xml * assets\ => app\src\main\assets * libs\fastjson-1.2.2.jar => app\libs\fastjson-1.2.2.jar * res\ => app\src\main\res\ * src\ => app\src\main\java\ Next Steps: ----------- You can now build the project. The Gradle project needs network connectivity to download dependencies. Bugs: ----- If for some reason your project does not build, and you determine that it is due to a bug or limitation of the Eclipse to Gradle importer, please file a bug at http://b.android.com with category Component-Tools. (This import summary is for your information only, and can be deleted after import once you are satisfied with the results.) ```

Android studio使用HttpurlConnection无法连接的问题。

背景:Android studio编写获取webservice soap xml 我在eclipse中用java编写的个测试例子, 用的是HttpurlConnection可以成功读取数据,但是我搬到Android studio中,无法连接,会跳转到catch。我也按照网上说的方法加了线程,以及httpclient不能使用情况下载build中加入相关uselibary等等方法,都无法连接成功。请问我应该怎么解决,有懂的朋友帮帮忙,谢谢。 以下是代码: confirm.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v){ new Thread(new Runnable() { @Override public void run() { String id= edit.getText().toString(); httpClient(id); } }).start(); //这段代码在主线程中调用,开启一个线程 // String id= edit.getText().toString(); // httpClient(id); } }); } private void httpClient(String id) { //以SOAP1.1的格式发送 String httpBody = XMLDom.requestSOAP1(id); myXMLPost(httpBody); } private void myXMLPost(final String httpBody) { Map<String, String> map1 = new HashMap<String, String>(); try {//创建post对象 HttpURLConnection connection = (HttpURLConnection) new URL("http://119.10.51.138:86/erp.asmx").openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "text/xml; charset=utf-8"); connection.setRequestProperty("SOAPAction", "http://tempuri.org/GetPROC_ORDER_Detail"); connection.connect();//连接服务器 OutputStream os = (OutputStream) connection.getOutputStream(); os.write(httpBody.getBytes()); os.flush(); os.close(); InputStream is = (InputStream) connection.getInputStream();//获取数据,真正的请求从此处开始 byte[] bts = new byte[is.available()]; is.read(bts); String detailResult = new String(bts); map1 = XMLDom.getLoginResult(detailResult); String s = map1.get("sl"); result.setText(s); } catch (Exception e) { e.printStackTrace(); result.setText("连接错误"); } }

自学android+服务器+mysql做注册登录功能

https://blog.csdn.net/qq_23035265/article/details/52625110 我按照这个教程来做,javaweb能运行,androidapp能运行,数据库也打开了,ip也设置好了,数据库名字表明都弄的一样的,数据库帐号密码也检查过,app布局id也检查过。但是输入了正确的帐号密码,settext是空白的。输入错误的帐号密码也不报错。mysql jar也导入了。我真的不知道我错哪里了。请问大家这个项目有什么要注意的吗,或者怎么检查出错原因。看android studio log cat?

Android使用HttpURLConnection简单的获取百度的首页源码失败?

就是想很简单的获取百度的源码,开了一个子线程,却不知到为什么一直获取失败。求高手告之原因。 代码: ``` public class MainActivity extends Activity implements View.OnClickListener { public static final int SHOW_RESPONSE = 0; private Button sendRequest; private TextView responseText; private Handler handler = new Handler() { public void handleMessage(Message msg) { switch (msg.what) { case SHOW_RESPONSE: String response = (String) msg.obj; // 在这里进行UI操作,将结果显示到界面上 responseText.setText(response); } } }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.web_layout); sendRequest = (Button) findViewById(R.id.send_request); responseText = (TextView) findViewById(R.id.response_text); sendRequest.setOnClickListener(this); } @Override public void onClick(View v) { if (v.getId() == R.id.send_request) { sendRequestWithHttpURLConnection(); } } private void sendRequestWithHttpURLConnection() { // 开启线程来发起网络请求 new Thread(new Runnable() { @Override public void run() { HttpURLConnection connection = null; try { URL url = new URL("http://www.baidu.com/"); connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setConnectTimeout(8000); connection.setReadTimeout(8000); connection.setDoInput(true); connection.setDoOutput(true); if(connection.getResponseCode()!=200) { Log.d("haha", "code is "+connection.getResponseCode()); } InputStream in = connection.getInputStream(); // 下面对获取到的输入流进行读取 BufferedReader reader = new BufferedReader( new InputStreamReader(in)); StringBuilder response = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { response.append(line); } Message message = new Message(); message.what = SHOW_RESPONSE; // 将服务器返回的结果存放到Message中 message.obj = response.toString(); handler.sendMessage(message); } catch (Exception e) { e.printStackTrace(); } finally { if (connection != null) { connection.disconnect(); } } } }).start(); } } ``` 布局代码: ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <Button android:id="@+id/send_request" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Send Request" /> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/response_text" android:layout_width="match_parent" android:layout_height="wrap_content" /> </ScrollView> </LinearLayout> ```

android webview webpage not available

初学android studio 今天尝试做了一个webview,权限什么的都已经搞定。 但是进入虚拟机,打开APP之后,打开网页却显示webpage not available。 但是如果我继续点击链接,就可以进入这个网站。求各位大神帮忙解决一下。 /* * @author hualang */ package com.example.sinma.myapplication; import android.app.Activity; import android.os.Bundle; import android.view.KeyEvent; import android.webkit.WebView; import android.webkit.WebViewClient; import com.example.sinma.myapplication.R; public class WebViewTest extends Activity { /** Called when the activity is first created. */ private WebView webview; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); webview=(WebView)findViewById(R.id.webview); //设置WebView属性,能够执行JavaScript脚本 webview.getSettings().setJavaScriptEnabled(true); //加载URL内容 webview.loadUrl("http://www.aimeeaccessories.com"); //设置web视图客户端 webview.setWebViewClient(new MyWebViewClient()); } //设置回退 public boolean onKeyDown(int keyCode,KeyEvent event) { if((keyCode==KeyEvent.KEYCODE_BACK)&&webview.canGoBack()) { webview.goBack(); return true; } return super.onKeyDown(keyCode,event); } //web视图客户端 public class MyWebViewClient extends WebViewClient { public boolean shouldOverviewUrlLoading(WebView view,String url) { view.loadUrl(url); return true; } } }

使用Volley将android应用程序连接到localhost的TimeoutError

<div class="post-text" itemprop="text"> <p>I want to make a web service that allow my app to connect with a database in localhost. I'm trying to follow this <a href="http://www.hermosaprogramacion.com/2015/05/crear-un-webservice-para-android-con-mysql-php-y-json/" rel="nofollow noreferrer">example</a> making some changes in the names.</p> <p>In my android code I have this:</p> <pre><code>VolleySingleton. getInstance(getApplicationContext()). addToRequestQueue(new JsonObjectRequest(Request.Method.GET, Constantes.GET, null, new Response.Listener&lt;JSONObject&gt;() { @Override public void onResponse(JSONObject response) { String result = response.toString(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { if (error.networkResponse == null) { if (error.getClass().equals(TimeoutError.class)) { // Show timeout error message Log.e("error volley",error.getStackTrace().toString()); Toast.makeText(getApplicationContext(), "Oops. Timeout error!", Toast.LENGTH_LONG).show(); } } } } )); </code></pre> <p><em>VolleySingleton</em> class:</p> <pre><code>public final class VolleySingleton { // Atributos private static VolleySingleton singleton; private RequestQueue requestQueue; private static Context context; private VolleySingleton(Context context) { VolleySingleton.context = context; requestQueue = getRequestQueue(); } public static synchronized VolleySingleton getInstance(Context context) { if (singleton == null) { singleton = new VolleySingleton(context.getApplicationContext()); } return singleton; } public RequestQueue getRequestQueue() { if (requestQueue == null) { requestQueue = Volley.newRequestQueue(context.getApplicationContext()); } return requestQueue; } public &lt;T&gt; void addToRequestQueue(Request&lt;T&gt; req) { getRequestQueue().add(req); } </code></pre> <p>The constants that I have in <em>Constantes</em> class:</p> <pre><code>private static final String PUERTO_HOST = "63343"; private static final String IP = "http://10.0.2.2:"; public static final String GET = IP + PUERTO_HOST + "/prueba/obtener_canales.php"; </code></pre> <p>I used that ip because I read that 10.0.2.2 is for android studio emulator and 10.0.3.2 is for genymotion.</p> <p>I'm using XAMPP and the route of my file is "D:\xampp\htdocs\prueba\obtener_canales.php</p> <p>I'm getting all time the Toast with timeout error and when I debug in android studio there's nothing to see.</p> </div>

Android开发执行Build APK命令报错

在使用Android Studio进行开发时,引入了C++代码,使用CMake进行了配置,现在在执行Build APK命令时,报了标题的错 'neon_vector_type' attribute is not supported for this target,请问该如何解决

安卓点击按钮不能实现跳转 模拟器运行软件点按钮就闪退

点登录按钮就闪退![图片说明](https://img-ask.csdn.net/upload/201906/28/1561723660_759733.jpg) 下面是代码 ```package com.example.test; import android.app.Activity; import com.example.test.R; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class Denglu extends Activity { Button denglu,zhuche; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.denglu); denglu=(Button)findViewById(R.id.denglu); zhuche=(Button)findViewById(R.id.zhuche); denglu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent=new Intent(Denglu.this,RegisterActivity.class); startActivity(intent); } }); zhuche.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //为了跳转到注册界面,并实现注册功能 Intent intent=new Intent(Denglu.this,LostFindActivity.class); startActivity(intent); finish(); } }); } } ``` 第二个 package com.example.test; import android.app.Activity; import com.example.test.R; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; public class LostFindActivity extends Activity { Button register; protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.zc); register =(Button)findViewById(R.id.register); register.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(LostFindActivity.this,RegisterActivity.class); startActivity(intent); Toast.makeText(LostFindActivity.this, "注册成功,跳转中", Toast.LENGTH_LONG).show(); finish(); } }); } } 第三个 package com.example.test; import com.example.test.MainActivity; import com.example.test.R; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.Toast; public class RegisterActivity extends Activity { Button denglu; protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.dl); denglu=(Button)findViewById(R.id.denglu); denglu.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(RegisterActivity.this,MainActivity.class); startActivity(intent); Toast.makeText(RegisterActivity.this, "登录成功,跳转中", Toast.LENGTH_LONG).show(); finish(); } }); } } 跳转不了 思路是先注册然后登陆 进主界面 下面是报错信息 ![图片说明](https://img-ask.csdn.net/upload/201906/28/1561724541_821567.jpg) 萌新一个 求各位大佬帮帮忙

请问下各位大佬们,我在用ksoap2-Android调用web service服务时出现了stream closed的报错

小弟仿照网上的一个例子想用web service服务写一个查询天气的安卓应用。 但是在该服务的第三个方法时出现了stream closed的错误,百度没有找到结果, 麻烦各位大神帮我看下,以下是我的代码,在根据城市获取城市具体天气情况这个 方法时报了错 提供服务的URL是http://ws.webxml.com.cn/WebServices/WeatherWS.asmx ``` public class WebServicerUtil { // 定义Web Service的命名空间 static final String SERVICE_NS = "http://WebXml.com.cn/"; // 定义Web Service提供服务的URL static final String SERVICE_URL = "http://ws.webxml.com.cn/WebServices/WeatherWS.asmx"; // 调用远程 Web Service获取省份列表 public static List<String> getProvinceList() { /** * 调用远程Web Service的getRegionProvince方法: 获得中国省份、直辖市、地区和与之对应的ID * <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://WebXml.com.cn/"> <string>黑龙江,3113</string> <string>吉林,3114</string> <string>辽宁,3115</string> <string>内蒙古,3116</string> <string>河北,3117</string> <string>河南,3118</string> <string>山东,3119</string> <string>山西,31110</string> <string>江苏,31111</string> <string>安徽,31112</string> <string>陕西,31113</string> <string>宁夏,31114</string> <string>甘肃,31115</string> <string>青海,31116</string> <string>湖北,31117</string> <string>湖南,31118</string> <string>浙江,31119</string> <string>江西,31120</string> <string>福建,31121</string> <string>贵州,31122</string> <string>四川,31123</string> <string>广东,31124</string> <string>广西,31125</string> <string>云南,31126</string> <string>海南,31127</string> <string>新疆,31128</string> <string>西藏,31129</string> <string>台湾,31130</string> <string>北京,311101</string> <string>上海,311102</string> <string>天津,311103</string> <string>重庆,311104</string> <string>香港,311201</string> <string>澳门,311202</string> <string>钓鱼岛,311203</string> </ArrayOfString> */ String methodName = "getRegionProvince"; //获得中国省份、直辖市、地区和与之对应的ID // 创建HttpTransportSE传输对象,该对象用于调用Web Service操作 HttpTransportSE ht = new HttpTransportSE(SERVICE_URL); ht.debug = true; // 使用SOAP1.1协议创建Envelop对象 SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); // 实例化SoapObject对象,传入所要调用的Web Service的命名空间,Web Service方法名 SoapObject soapObject = new SoapObject(SERVICE_NS, methodName); //将 soapObject对象设置为SoapSerializationEnvelope对象的传出SOAP消息 envelope.bodyOut = soapObject; /** * 因为什么这个网站是通过.NET对外提供Web Service的, * 因此设置与.Net提供的Web Service保持较好的兼容性 */ envelope.dotNet = true; try { // 调用Web Service ht.call(SERVICE_NS + methodName, envelope); if (envelope.getResponse() != null) { // 获取服务器响应返回的SOAP消息 SoapObject result = (SoapObject) envelope.bodyIn; SoapObject detail = (SoapObject) result.getProperty(methodName + "Result"); // 解析服务器响应的SOAP消息。 return parseProvinceOrCity(detail); } } catch (IOException e) { e.printStackTrace(); } catch (XmlPullParserException e) { e.printStackTrace(); } return null; } // 根据省份获取城市列表 public static List<String> getCityListByProvince(String province) { /** * 调用的方法 * 获得支持的城市/地区名称和与之对应的ID 输入参数:theRegionCode = 省市、国家ID或名称,返回数据:一维字符串数组。 如:输入北京的theRegionCode:311101得到的返回结果为: <ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://WebXml.com.cn/"> <string>北京,792</string> <string>昌平,785</string> <string>大兴,826</string> <string>房山,827</string> <string>怀柔,752</string> <string>门头沟,788</string> <string>密云,751</string> <string>平谷,756</string> <string>顺义,741</string> <string>通州,3409</string> <string>延庆,746</string> <string>海淀,742</string> <string>朝阳,3408</string> <string>丰台,795</string> <string>石景山,794</string> </ArrayOfString> */ String methodName = "getSupportCityString"; // 创建HttpTransportSE传输对象 HttpTransportSE ht = new HttpTransportSE(SERVICE_URL); ht.debug = true; // 实例化SoapObject对象 SoapObject soapObject = new SoapObject(SERVICE_NS, methodName); // 添加一个请求参数 soapObject.addProperty("theRegionCode", province); // 使用SOAP1.1协议创建Envelop对象 SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); envelope.bodyOut = soapObject; // 设置与.Net提供的Web Service保持较好的兼容性 envelope.dotNet = true; try { // 调用Web Service ht.call(SERVICE_NS + methodName, envelope); if (envelope.getResponse() != null) { // 获取服务器响应返回的SOAP消息 SoapObject result = (SoapObject) envelope.bodyIn; SoapObject detail = (SoapObject) result.getProperty(methodName + "Result"); // 解析服务器响应的SOAP消息。 return parseProvinceOrCity(detail); } } catch (IOException e) { e.printStackTrace(); } catch (XmlPullParserException e) { e.printStackTrace(); } return null; } // 解析服务器响应的SOAP消息。 private static List<String> parseProvinceOrCity(SoapObject detail) { List<String> result = new ArrayList<String>(); for (int i = 0; i < detail.getPropertyCount(); i++) { // 解析出每个省份 result.add(detail.getProperty(i).toString().split(",")[0]); } return result; } // 根据城市获取城市具体天气情况 public static SoapObject getWeatherByCity(String cityName) { String methodName = "getWeather"; HttpTransportSE ht = new HttpTransportSE(SERVICE_URL); ht.debug = true; SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); SoapObject soapObject = new SoapObject(SERVICE_NS, methodName); soapObject.addProperty("theCityCode", cityName); envelope.bodyOut = soapObject; // 设置与.Net提供的Web Service保持较好的兼容性 envelope.dotNet = true; try { ht.call(SERVICE_NS + methodName, envelope); SoapObject result = (SoapObject) envelope.bodyIn; SoapObject detail = (SoapObject) result.getProperty(methodName + "Result"); return detail; } catch (Exception e) { e.printStackTrace(); } return null; } } ``` 下边是报错内容 ``` 2019-12-22 15:35:47.617 29228-29259/? W/System.err: java.io.IOException: Stream closed 2019-12-22 15:35:47.617 29228-29259/? W/System.err: at java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:151) 2019-12-22 15:35:47.617 29228-29259/? W/System.err: at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) 2019-12-22 15:35:47.617 29228-29259/? W/System.err: at java.io.BufferedInputStream.read1(BufferedInputStream.java:275) 2019-12-22 15:35:47.617 29228-29259/? W/System.err: at java.io.BufferedInputStream.read(BufferedInputStream.java:334) 2019-12-22 15:35:47.618 29228-29259/? W/System.err: at org.ksoap2.transport.HttpTransportSE.readDebug(HttpTransportSE.java:299) 2019-12-22 15:35:47.618 29228-29259/? W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:261) 2019-12-22 15:35:47.618 29228-29259/? W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:118) 2019-12-22 15:35:47.618 29228-29259/? W/System.err: at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:113) 2019-12-22 15:35:47.619 29228-29259/? W/System.err: at com.example.weather.WebServicerUtil.getWeatherByCity(WebServicerUtil.java:205) 2019-12-22 15:35:47.619 29228-29259/? W/System.err: at com.example.weather.MyWeather.showWeather(MyWeather.java:147) 2019-12-22 15:35:47.619 29228-29259/? W/System.err: at com.example.weather.MyWeather.access$200(MyWeather.java:21) 2019-12-22 15:35:47.619 29228-29259/? W/System.err: at com.example.weather.MyWeather$3$1.run(MyWeather.java:125) 2019-12-22 15:35:47.619 29228-29259/? W/System.err: at java.lang.Thread.run(Thread.java:761) 2019-12-22 15:35:47.619 29228-29259/? E/AndroidRuntime: FATAL EXCEPTION: Thread-4 Process: com.example.weather, PID: 29228 java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object org.ksoap2.serialization.SoapObject.getProperty(int)' on a null object reference at com.example.weather.MyWeather.showWeather(MyWeather.java:150) at com.example.weather.MyWeather.access$200(MyWeather.java:21) at com.example.weather.MyWeather$3$1.run(MyWeather.java:125) at java.lang.Thread.run(Thread.java:761) 2019-12-22 15:35:47.684 29228-29251/? D/EGL_emulation: eglMakeCurrent: 0xa26a6a60: ver 3 0 (tinfo 0xa461a8d0) ```

Android如何在viewpager中添加WebView?

我写了一个viewpager,共有5个界面。想在viewpager界面上显示webview,写完之后代码没有提示错误,但一直运行不了,求解决,贴上源代码。 package com.example.young; import java.util.ArrayList; import java.util.List; import com.example.young.utils.WebView1; import android.app.Activity; import android.app.LocalActivityManager; import android.content.Context; import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.webkit.WebView; public class TabyixueActivity extends Activity{ //存放页面的容器 List<View> listViews; //上下文 Context context; @SuppressWarnings("deprecation") LocalActivityManager manager = null; //实现翻页的组件 private ViewPager pager = null; //生成webview数组 private WebView webView[]; //private List<View> webView; private void InitWebView() { //加载webview webView[0]=(WebView1)findViewById(R.id.webView21); //webView[1]=(WebView1)findViewById(R.id.webView22); //webView[2]=(WebView1)findViewById(R.id.webView23); //webView[3]=(WebView1)findViewById(R.id.webView24); //webView[4]=(WebView1)findViewById(R.id.webView25); //加载网页 webView[0].loadUrl("http://www.baidu.com"); //webView[1].loadUrl("http://www.sohu.com"); //webView[2].loadUrl("http://www.sina.com"); //webView[3].loadUrl("http://www.qq.com"); //webView[4].loadUrl("http://www.360.com"); } @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.layout_yixue); LayoutInflater inflater = LayoutInflater.from(this); manager = new LocalActivityManager(this, true); manager.dispatchCreate(savedInstanceState); context = TabyixueActivity.this; // 呈现页面滑动效果 pager = (ViewPager) findViewById(R.id.yixuetext); listViews = new ArrayList<View>(); View view1 = inflater.inflate(R.layout.yixue_1, null); View view2 = inflater.inflate(R.layout.yixue_2, null); View view3 = inflater.inflate(R.layout.yixue_3, null); View view4 = inflater.inflate(R.layout.yixue_4, null); View view5 = inflater.inflate(R.layout.yixue_5, null); listViews.add(view1); listViews.add(view2); listViews.add(view3); listViews.add(view4); listViews.add(view5); //滑页适配器 pager.setAdapter(pagerAdapter); pager.setOnPageChangeListener(new OnPageChangeListener(){ @Override public void onPageSelected(int position){ //stetDots(); } @Override public void onPageScrolled(int arg0,float arg1,int arg2){} @Override public void onPageScrollStateChanged(int arg0){} }); InitWebView(); } private void addView(List<View> view,String url){ WebView webView =new WebView(this); webView.loadUrl(url); view.add(webView); } private PagerAdapter pagerAdapter=new PagerAdapter(){ @Override //这里获得当前页卡 public Object instantiateItem(ViewGroup view,int position){ view.addView(listViews.get(position)); return listViews.get(position); } @Override //得到所有页卡的个数 public int getCount() { return listViews.size(); } @Override //判断当前显示页卡是否匹配 public boolean isViewFromObject(View arg0, Object arg1) { return arg0==arg1; } @Override //销毁页卡 public void destroyItem(ViewGroup view,int position,Object arg2){ ViewPager pViewPager=((ViewPager)view); pViewPager.removeView(listViews.get(position)); } }; }

项目打包突然一直报错,求求各位大神帮忙!

![图片说明](https://img-ask.csdn.net/upload/201908/31/1567205173_735215.jpg) 已经查遍百度无数的方法都不行

Android开发:临时路径更改后一调用摄像头APP就闪退

![图片说明](https://img-ask.csdn.net/upload/201710/24/1508847425_643266.png) 如图中所示,我将getExternalCache()改成getCache()后再点击调用摄像头的按钮时候软件就闪退了(在此之前是可以正常调用摄像头的,且只改动了这一处)。 最大的问题是我改回getExternalCache()后重新调试软件依旧会闪退。无法调用摄像头

android图片上传失败,服务器返回405,求解

我在写一个安卓手机端的图片上传功能,写了个工具类用的是httpurlconnection发送post请求,结果服务器返回405(方法不允许)。到底是哪里的问题?该怎么解决?急求!在线等!!!

这个报错是什么问题,怎没改

java.lang.NoSuchMethodError: com.mohe.retailer.user.entity.TbUser.getUTel()Ljava/lang/Integer; at org.apache.jsp.WEB_002dINF.jsp.smartadmin.posuser.addusers_jsp._jspService(addusers_jsp.java:160) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338) at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1217) at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) at javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source) 七月 24, 2017 10:18:20 上午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [spring] in context with path [/market] threw exception [javax.servlet.ServletException: java.lang.NoSuchMethodError: com.mohe.retailer.user.entity.TbUser.getUTel()Ljava/lang/Integer;] with root cause java.lang.NoSuchMethodError: com.mohe.retailer.user.entity.TbUser.getUTel()Ljava/lang/Integer; at org.apache.jsp.WEB_002dINF.jsp.smartadmin.posuser.addusers_jsp._jspService(addusers_jsp.java:160) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:748) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:486) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:411) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:338) at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209) at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267) at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1217) at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) at javax.servlet.http.HttpServlet.service(HttpServlet.java:620) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Unknown Source)

不能够在webview中显示网页,出现Webpage not available

public class MainActivity extends Activity { private String url = "http://www.hao123.com/"; private WebView webView; private ProgressDialog dialog; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.web); // Uri uri = Uri.parse(url); // Intent intent = new Intent(Intent.ACTION_VIEW,uri); // startActivity(intent); init(); } private void init() { // TODO Auto-generated method stub webView = (WebView) findViewById(R.id.webView); webView.loadUrl(url); webView.setWebViewClient(new WebViewClient(){ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { // TODO Auto-generated method stub view.loadUrl(url); return true; } }); WebSettings settings = webView.getSettings(); settings.setJavaScriptEnabled(true); webView.setWebChromeClient(new WebChromeClient(){ @Override public void onProgressChanged(WebView view, int newProgress) { // TODO Auto-generated method stub if(newProgress == 100){ closeDialog(); } else{ openDialog(newProgress); } } private void closeDialog() { // TODO Auto-generated method stub if(dialog != null && dialog.isShowing()){ dialog.dismiss(); dialog = null; } } private void openDialog(int newProgress) { // TODO Auto-generated method stub if(dialog == null){ dialog = new ProgressDialog(MainActivity.this); dialog.setTitle("正在加载"); dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); dialog.setProgress(newProgress); dialog.show(); } else{ dialog.setProgress(newProgress); } } }); } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { // TODO Auto-generated method stub if(keyCode == KeyEvent.KEYCODE_BACK){ Toast.makeText(this,webView.getUrl(),Toast.LENGTH_SHORT).show(); if(webView.canGoBack()){ webView.goBack(); return true; } else{ System.exit(0); } } return super.onKeyDown(keyCode, event); } } 注册文件已经加了权限。本来是可以加载网页的,制作了进度条判断页面的加载过程,就出错了。LOG显示08-25 03:01:29.029: E/cutils-trace(2289): Error opening trace file: No such file or directory (2)

android中使用webview打开网页,网页中的链接一点击就显示找不到网页

android中使用webview打开网页,一开始网页可以打开,可是网页中的链接一点击就显示找不到网页 rt,谢谢 newsshow.setWebViewClient(new WebViewClient(){ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { // TODO Auto-generated method stub //返回值是true的时候控制去WebView打开,为false调用系统浏览器或第三方浏览器 view.loadUrl(url); return super.shouldOverrideUrlLoading(view, url); }

android第三方jar包无法import

我把ksoap2放在了libs里面,并且在dependencies中编译了,但是无法import。用的时androidstdio

Visual Studio网站设计不能运行,“/”应用程序中的服务器错误。

![图片说明](https://img-ask.csdn.net/upload/201903/07/1551948205_911477.png)

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《Oracle Java SE编程自学与面试指南》最佳学习路线图2020年最新版(进大厂必备)

正确选择比瞎努力更重要!

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

字节跳动面试官竟然问了我JDBC?

轻松等回家通知

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

阿里面试官让我用Zk(Zookeeper)实现分布式锁

他可能没想到,我当场手写出来了

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

立即提问
相关内容推荐