Android 知道为什么一些智能手机的微调器组件出现故障,而另一些智能手机的微调器组件加载正常吗?

Android 知道为什么一些智能手机的微调器组件出现故障,而另一些智能手机的微调器组件加载正常吗?,android,list,spinner,Android,List,Spinner,这是我在使用android应用程序时遇到的最奇怪的错误之一。我有一个从数组中动态提取的代码部分,用于填充我的应用程序中的微调器组件。Spinner在运行android 7.0的Oukitel K10智能手机上运行时没有任何问题,但无法在Tecno Camon 15上运行,这是一款具有良好内存和处理能力的最新智能手机 我真诚地希望有人有过类似的经历,这样他们就可以分享如何最好地解决这个问题 不同智能手机上的微调器组件出现这种异常行为的原因可能是什么 先谢谢你 布局 <?xml version

这是我在使用android应用程序时遇到的最奇怪的错误之一。我有一个从数组中动态提取的代码部分,用于填充我的应用程序中的微调器组件。Spinner在运行android 7.0的Oukitel K10智能手机上运行时没有任何问题,但无法在Tecno Camon 15上运行,这是一款具有良好内存和处理能力的最新智能手机

我真诚地希望有人有过类似的经历,这样他们就可以分享如何最好地解决这个问题

不同智能手机上的微调器组件出现这种异常行为的原因可能是什么

先谢谢你

布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="@drawable/appback2"

    android:paddingBottom="10dp"
    android:paddingLeft="10dp"
    android:paddingRight="10dp"
    android:paddingTop="10dp"
    tools:context=".payElectActivity">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:background="#74CDBBD7"
        android:weightSum="2">

        <TextView
            android:id="@+id/pageHeader"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Pay Electricity Bill"
            android:textColor="@color/colorWhite"
            android:background="#9C27B0"

            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:textSize="30dp" />


        <Spinner
            android:id="@+id/electspinner"
            android:layout_marginTop="40dp"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:popupTheme="@android:style/ThemeOverlay.Material.Light"
            android:popupBackground="@android:color/transparent"
            android:layout_weight="1"/>



        <EditText
            android:id="@+id/meterno"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"

            android:textStyle="italic"
            android:hint="Enter Meter No."
            android:textSize="20dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            />


        <Button
            android:id="@+id/verifynow"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"

            android:textColor="@color/colorYellow2"
            android:background="@drawable/action_button2"
            android:text="Do Customer Verification" />


        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dp"

            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:orientation="horizontal"

            android:weightSum="2">

            <TextView
                android:id="@+id/customerinfo"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"


                android:text="..."
                android:textColor="@color/colorBlack"
                android:background="@color/colorWhite"

                android:layout_alignParentTop="true"
                android:layout_centerHorizontal="true"
                android:textSize="18dp" />

        </LinearLayout>
        <Spinner
            android:id="@+id/mtrspinner"
            android:layout_marginTop="30dp"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"

            android:popupTheme="@android:style/ThemeOverlay.Material.Light"
            android:popupBackground="@android:color/transparent"
            android:layout_weight="1"/>

        <EditText
            android:id="@+id/phonenumber"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"

            android:textStyle="italic"
            android:hint="Recipient's Phone"
            android:textSize="20dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            />

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="5dp"

            android:orientation="horizontal"
            android:background="#B9E5D1F1"
            android:gravity="center"
            android:weightSum="2">

            <Button
                android:id="@+id/amount1000"
                android:layout_width="60dp"
                android:layout_height="20dp"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="5dp"

                android:textColor="#080309"
                android:background="#8B716A72"
                android:text="1000"

                android:gravity="center"/>

            <Button
                android:id="@+id/amount1500"
                android:layout_width="60dp"
                android:layout_height="20dp"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="5dp"


                android:textColor="#080309"
                android:background="#8BC3A48D"
                android:text="1500"

                android:gravity="center"/>

            <Button
                android:id="@+id/amount2000"
                android:layout_width="60dp"
                android:layout_height="20dp"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="5dp"

                android:textColor="#080309"
                android:background="#8B716A72"
                android:text="2000"

                android:gravity="center"/>

            <Button
                android:id="@+id/amount3000"
                android:layout_width="60dp"
                android:layout_height="20dp"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="5dp"


                android:textColor="#080309"
                android:background="#8BC3A48D"
                android:text="3000"

                android:gravity="center"/>

            <Button
                android:id="@+id/amount5000"
                android:layout_width="60dp"
                android:layout_height="20dp"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="5dp"

                android:background="#8B716A72"
                android:textColor="#080309"

                android:text="5000"

                android:gravity="center"/>

        </LinearLayout>


        <EditText
            android:id="@+id/amounttopay"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"

            android:textStyle="italic"
            android:hint="Enter Amount"
            android:textSize="20dp"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="10dp"
            android:layout_marginRight="10dp"
            android:background="#B9E5D1F1"
            android:gravity="center"
            android:orientation="horizontal"
            android:weightSum="2">

        <Button
            android:id="@+id/topupnow"
            android:layout_width="200dp"
            android:layout_height="40dp"

            android:layout_marginTop="5dp"
            android:layout_marginBottom="5dp"

            android:textColor="#9C27B0"
            android:background="@drawable/action_button1"
            android:text="Do Recharge"
            android:layout_gravity="center"/>

        </LinearLayout>

        <ProgressBar
            android:id="@+id/progressBar1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:visibility="invisible"
            android:indeterminateTint="@android:color/holo_orange_dark"
            android:layout_gravity="center"
            android:layout_centerHorizontal="true"/>

        <TextView
            android:id = "@+id/tvIsConnected"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dp"
            android:gravity="center"/>

    </LinearLayout>>


</LinearLayout>
节执行阵列的实际加载

if( typeUrl.equals("1") || typeUrl.equals("51"))
                {
                   String responseVal="";

                   JSONArray nodesArray =null;


                    if (typeUrl.equals("51"))
                    nodesArray = jsonResponse.getJSONArray("alldiscos");
                     else  nodesArray = jsonResponse.getJSONArray("result");

                 

                   allNetworks.clear();

                    for (int i=0; i < nodesArray.length(); i++){

                        JSONObject itemArr = (JSONObject)nodesArray.get(i);

                         prodID = itemArr.getString("product_id");
                         discoName = itemArr.getString("name");

                         pathName = discoName+"~"+prodID;

                        allNetworks.add(pathName);
                        adapter.notifyDataSetChanged();

                    }

                }

            } catch (final JSONException e) {
                Log.e(TAG, "Json parsing error: " + e.getMessage());
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Toast.makeText(getApplicationContext(),
                                "Json parsing error: " + e.getMessage(),
                                Toast.LENGTH_LONG).show();
                    }
                });

            }
if(typeUrl.equals(“1”)| typeUrl.equals(“51”))
{
字符串responseVal=“”;
JSONArray nodesArray=null;
if(typeUrl.equals(“51”))
nodesArray=jsonResponse.getJSONArray(“alldiscos”);
else nodesArray=jsonResponse.getJSONArray(“结果”);
allNetworks.clear();
对于(int i=0;i
它归结为在原始请求中将“http://”更改为“https://”。非常悲伤,因为这只是一个缺失的“s”角色,但我最终解决了我最具挑战性的错误,这让我很满足。它表明,我从应用程序发出的获取列表的请求是不稳定的,因为它允许某些智能手机发出安全请求,但其他智能手机可以绕过它。这是一次令人惊叹的学习体验。

您能添加代码吗?没有人可以帮助你。我添加了更多的代码。谢谢
 private void doDiscosArray() {

        String verifyURL = "http://mmgetreuutter.com/httpapi/power-lists?userid=0844356451&pass=305f988a5536ddsa81a2";


         result = "";

        if(netConn){
            //Instantiate new instance of our class
            HTTPAsyncTask getRequest = new HTTPAsyncTask();
           //Perform the doInBackground method, passing in our url
            try {
                //Get array list from jsonbinio
                result = getRequest.execute(verifyURL,"1").get();

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

        }


    }
if( typeUrl.equals("1") || typeUrl.equals("51"))
                {
                   String responseVal="";

                   JSONArray nodesArray =null;


                    if (typeUrl.equals("51"))
                    nodesArray = jsonResponse.getJSONArray("alldiscos");
                     else  nodesArray = jsonResponse.getJSONArray("result");

                 

                   allNetworks.clear();

                    for (int i=0; i < nodesArray.length(); i++){

                        JSONObject itemArr = (JSONObject)nodesArray.get(i);

                         prodID = itemArr.getString("product_id");
                         discoName = itemArr.getString("name");

                         pathName = discoName+"~"+prodID;

                        allNetworks.add(pathName);
                        adapter.notifyDataSetChanged();

                    }

                }

            } catch (final JSONException e) {
                Log.e(TAG, "Json parsing error: " + e.getMessage());
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Toast.makeText(getApplicationContext(),
                                "Json parsing error: " + e.getMessage(),
                                Toast.LENGTH_LONG).show();
                    }
                });

            }