如何从字符串Arraylist中将文本设置为textview

时间:2016-02-06 08:27:56

标签: java android arraylist

如何设置字符串arraylist" mylist [0]"作为textview的文本?

Intent in= getIntent();
        ArrayList<String> mylist = in.getStringArrayListExtra("rname");

        TextView t = (TextView) findViewById(R.id.textView);
        t.setText(mylist[0]);//getting error here saying "array type expected"
    }

2 个答案:

答案 0 :(得分:1)

您可以替换此代码

   Go to System Preferences -> Keyboard.

   Click the Shortcuts tab.

   Select Spotlight in the left pane (see screenshot below).

   UnSelect Show Spotlight Search field next to the shortcut
   combination ^Space as shown in the screenshot below  or Change it to
your preferred shortcut.

    You can change shortcut key in Eclipse by going to 

    Preferences > General > Keys and filtering for 'content assist'.

    Change/Update the Shortcut key to your preferred one. (I preferred Alt+Space)

答案 1 :(得分:0)

     List<String> mStrings = new ArrayList<String>();

        Editable s = editText.getText();

            char c;
            for(int i=0; i< editText.length(); i++){

                char result = s.charAt(i);
                 textView.append(String.valueOf(result));
               mStrings.add(String.valueOf(result));

                try{

                    Thread.sleep(10);
                    editText.setText(mStrings.get(1));
                }catch(Exception e){}

    }
相关问题