本帖最后由 q772135667 于 2014-07-09 10:18:46 编辑

解决方案 »

  1.   

    表示你的数组没有初始化 String[] str = new String[..];
      

  2.   

    shuchu String[] shuchu = new String[需要的长度];
      

  3.   

    shuchu String[] shuchu = new String[需要的长度];谢谢我试试~String[] shuchu = new String[4];可以这样初始化吧?不好意思我是菜鸟。
      

  4.   

    shuchu String[] shuchu = new String[需要的长度];谢谢我试试~String[] shuchu = new String[4];可以这样初始化吧?不好意思我是菜鸟。
    可以 4代表能放四条数据 超过则会报java.lang.ArrayIndexOutOfBoundsException异常
      

  5.   

    shuchu String[] shuchu = new String[需要的长度];谢谢我试试~String[] shuchu = new String[4];可以这样初始化吧?不好意思我是菜鸟。
    可以 4代表能放四条数据 超过则会报java.lang.ArrayIndexOutOfBoundsException异常谢谢你,成功了!但是为什么我写完程序后生成apk放在手机上安装不了呢?我的SDk是安卓4.2.2的手机系统是安卓4.2深度定制版。
      

  6.   

    安装不了?能具体说下么  用usb接上电脑 直接手机调试 可以看到异常信息
      

  7.   

    对呀。。点完安装它就显示应用未安装。该怎么连上USB调试呢?谢谢您~
      

  8.   

    是编完程序直接生成未签名的apk就行么?不需要别的设置么?
      

  9.   

    测试的话不需要签名 usb调试的话 手机usb接入电脑 打开手机设置里面的开发者选项的usb调试device里面看到手机了 就代表连接成功了 直接运行程序就ok了 可以早logcat查看异常信息
      

  10.   

    谢谢您,我这个可能是版本太高的原因么?我的Android是4.2.2的,SDK里只有这一个安卓系统。
      

  11.   

    版本的话 在AndroidManifest.xml里面可以修改
     <uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="17" />
      

  12.   

    是直接添加这一句么?我的Manifest里没有这一句。
      

  13.   

    是的 你可以加上用手机调试一下看一下 如果还是不能安装 logcat应该会有异常信息打印
      

  14.   

    你只是定义了一个shuchu[] 数组,但没有初始化,没初始化它没有长度,没有初始化,shuchu[] = null
      

  15.   

    接收短信后不跳转界面 什么意思?您好,是这个意思,我这个程序写的是打开app后显示的是等待接收短信,然后一接到短信他会跳转到读取短信的那个界面,用安卓模拟器运行一切都正常,但是用手机打开之后只会停留在等待接收短信的那个界面,手机收到短信也一直都不跳转。谢谢您一直这么耐心的解答。
      

  16.   

    package com.bn.chap6.chd;
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.os.Handler;
    import android.os.Message;
    import android.view.View;
    import android.widget.Button;
    import android.widget.EditText;public class Sample6_5_Activity extends Activity {
        /** Called when the activity is first created. */
    Handler hd=new Handler()
        {
         @Override
         public void handleMessage(Message msg)
         {
         switch(msg.what)
         {
         case 0:
         Bundle b=msg.getData();
             String tempMsg=(String) b.get("xx"); 
         gotoXX(tempMsg);//进入信息界面
         break;
         }
         }
        };
    @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
         Bundle bundle=this.getIntent().getExtras();//取得短信发来bundle
         if(bundle!=null)
         {
         String tempMsg=bundle.getString("change");//获取信息
         Bundle b=new Bundle();
                b.putString("xx", tempMsg);
                Message m=new Message();
                m.what=0;//
                m.setData(b);
                hd.sendMessage(m);
         }else
         {
          setContentView(R.layout.main);//设置主界面
         }
        }
        public void gotoXX(String msg)
        {
         setContentView(R.layout.xx);//设置当前界面
            Button buttonn=(Button)findViewById(R.id.button1);
          buttonn.setOnClickListener(new Button.OnClickListener() {
    public void onClick(View v)
    {
    Intent intent=new Intent();
    intent.setClassName("com.yarin.android.Examples_04_09", "com.yarin.android.Examples_04_09.Activity01");
    startActivity(intent);
    }
    });
         EditText ettt=(EditText)this.findViewById(R.id.editText1);
         EditText etttt=(EditText)this.findViewById(R.id.editText2);
         EditText ettttt=(EditText)this.findViewById(R.id.editText3);
           EditText etttttt=(EditText)this.findViewById(R.id.editText4);
           EditText ettttttt=(EditText)this.findViewById(R.id.editText5);
           EditText etttttttt=(EditText)this.findViewById(R.id.editText6);
         String[] tempMsg=msg.split("\\|");
         String[] tempMs=tempMsg[1].split("-");
         ettt.setText(tempMs[0]);
         etttt.setText(tempMs[1]);
         ettttt.setText(tempMs[2]);
         etttttt.setText(tempMs[3]);
         ettttttt.setText(tempMs[4]);
         etttttttt.setText(tempMs[5]);
        }
    }
      

  17.   

    接收短信后不跳转界面 什么意思?您好,是这个意思,我这个程序写的是打开app后显示的是等待接收短信,然后一接到短信他会跳转到读取短信的那个界面,用安卓模拟器运行一切都正常,但是用手机打开之后只会停留在等待接收短信的那个界面,手机收到短信也一直都不跳转。谢谢您一直这么耐心的解答。贴了那个java程序麻烦您看一下。
      

  18.   


    你确定你那程序能拦截到短信
    你去看下这个把 - - http://www.cnblogs.com/GarfieldTom/archive/2012/08/25/2655609.html
      

  19.   

    呵呵 弄好就行 是什么原因呢我加了一句android:priority="1000",短信拦截的优先级就提高了!