Android 我的代码不会将字符串的值乘以整数

Android 我的代码不会将字符串的值乘以整数,android,Android,当从微调器中选择任意数字时,我想将字符串值乘以,但问题是textview值是字符串“Rs.6849”,如何将此字符串与微调器中的任意数字相乘?我是soconfuse值off tet视图来自服务器,因此无法更改如何使用微调器更改字符串我需要有关如何使用微调器整数多重字符串的帮助????如何在选择的每个微调器值上更新textview TextViewprice =( "Rs.6,849") ; TextViewprice = (TextView) findViewB

当从微调器中选择任意数字时,我想将字符串值乘以,但问题是textview值是字符串“Rs.6849”,如何将此字符串与微调器中的任意数字相乘?我是soconfuse值off tet视图来自服务器,因此无法更改如何使用微调器更改字符串我需要有关如何使用微调器整数多重字符串的帮助????如何在选择的每个微调器值上更新textview

         TextViewprice =( "Rs.6,849") ;
        TextViewprice = (TextView) findViewById(R.id.TextViewprice);

             spn = (Spinner) findViewById(R.id.spnner);
            spn.setOnItemSelectedListener(new OnItemSelectedListener()
            {

    public void onItemSelected(AdapterView<?> arg0, View arg1,int arg2, long arg3)
      String multiple;
              multiple= 
      String.valueOf( Integer.parseInt(spn.getSelectedItem().toString())*
               Integer.parseInt(TextViewprice.getText().toString()));


               {
                  T
       extViewprice.setText(multiple);
               }

            @Override
            public void onNothingSelected(AdapterView<?> arg0) {
                // TODO Auto-generated method stub

            }

             });  


   <Spinner
    android:id="@+id/spnner"
    android:layout_height="wrap_content"
    android:layout_marginLeft="10dp"
       android:layout_marginRight="10dp"
    android:layout_width="wrap_content"
    android:entries="@array/feedbacktypelist"></Spinner>




              <string-array name="feedbacktypelist">
            <item>1</item>
            <item>2</item>
            <item>3</item>
            <item>4</item>
            <item>5</item>
            <item>6</item>

            <item>7</item>
            <item>8</item>
             <item>9</item>
              <item>10</item>
     </string-array>

您只需要从字符串中提取数字,然后进行乘法

String value = TextViewprice.getText().toString()
value = value.replaceAll("\\D+",""); //REGEX
multiple = String.valueOf( Integer.parseInt(spn.getSelectedItem().toString())*      Integer.parseInt(value);

您只需要从字符串中提取数字,然后进行乘法

String value = TextViewprice.getText().toString()
value = value.replaceAll("\\D+",""); //REGEX
multiple = String.valueOf( Integer.parseInt(spn.getSelectedItem().toString())*      Integer.parseInt(value);

您只需要从字符串中提取数字,然后进行乘法

String value = TextViewprice.getText().toString()
value = value.replaceAll("\\D+",""); //REGEX
multiple = String.valueOf( Integer.parseInt(spn.getSelectedItem().toString())*      Integer.parseInt(value);

您只需要从字符串中提取数字,然后进行乘法

String value = TextViewprice.getText().toString()
value = value.replaceAll("\\D+",""); //REGEX
multiple = String.valueOf( Integer.parseInt(spn.getSelectedItem().toString())*      Integer.parseInt(value);

查找Integer.parseInt。您将需要传递一个有效的整数,不包括aphabets等;否则,您将遇到一个numberformatexception您的代码看起来很好您已经在将字符串解析为整数了,您面临什么问题?查找Integer.parseInt。您将需要传递一个有效的整数,不包括aphabets等;否则,您将遇到一个numberformatexception您的代码看起来很好您已经在将字符串解析为整数了,您面临什么问题?查找Integer.parseInt。您将需要传递一个有效的整数,不包括aphabets等;否则,您将遇到一个numberformatexception您的代码看起来很好您已经在将字符串解析为整数了,您面临什么问题?查找Integer.parseInt。您将需要传递一个有效的整数,不包括aphabets等;否则,您将遇到一个numberformatexception您的代码似乎很好您已经在将字符串解析为整数了,您面临什么问题?