小编Res*_*hma的帖子

java.net.UnknownHostException:无法解析主机"<url>":没有与主机名关联的地址和字符0处的输入结束

我创建了一个从我的Web服务加载问题的应用程序,它运行正常.但是,有时它崩溃,我不明白为什么会发生这种情况,特别是因为我还给了它所需的权限.它工作正常,但随机,它崩溃,并给我这个报告.

private void sendContinentQuestions(int id) {
    // TODO Auto-generated method stub

    //Get the data (see above)
    JSONArray json = getJSONfromURL(id);
        try{
            for(int i=0; i < json.length(); i++) {
                HashMap<String, String> map = new HashMap<String, String>();
                JSONObject jObject = json.getJSONObject(i);
                longitude":"72.5660200"
                String category_id = jObject.getString("category_id");
                String question_id = jObject.getString("question_id");
                String question_name = jObject.getString("question_name");
                String latitude = jObject.getString("latitude");
                String longitude = jObject.getString("longitude");
                String answer = jObject.getString("answer");
                String ansLatLng = latitude+"|"+longitude ; 
                Log.v("## data:: ###",question_id+"--"+question_name+"-cat id-"+category_id+"--ansLatLng "+ansLatLng+" answer: "+answer);

                all_question.add(new QuestionData(game_id,category_id,question_id,question_name,ansLatLng,answer));
            }
        }catch(JSONException …
Run Code Online (Sandbox Code Playgroud)

java android web-services android-asynctask

61
推荐指数
6
解决办法
12万
查看次数

如何在弹出窗口的右上角显示关闭[X]按钮

在此输入图像描述

我想在我的应用程序中添加一个弹出窗口,就像在我的 UI 中一样,它将出现在布局的核心。任何人都可以帮助我如何记录这样的关闭图像吗?

我正在我的代码中采用框架布局。这是我的代码:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="#FFFFFF" >

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="right"
    android:src="@drawable/closeImg" />

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="3dp"
        android:gravity="right"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/txt_speciality_type"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Name: " />

        <TextView
            android:id="@+id/textView4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="add:" />

        <TextView
            android:id="@+id/textView5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="phone :" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="3dp"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/textView3"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="abc abc abc" />

        <TextView
            android:id="@+id/textView4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="abc" />

        <TextView
            android:id="@+id/textView5"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="230020202" />
    </LinearLayout> …
Run Code Online (Sandbox Code Playgroud)

xml android android-layout

0
推荐指数
1
解决办法
8927
查看次数