开发者

How to check the checkbox after receiving the message in android

开发者 https://www.devze.com 2023-04-12 16:23 出处:网络
I am making an application for android mobiles in which i have to receive the message string and then split that string in parts(each parts containing 2 characters).I am able to do up-to this much.

I am making an application for android mobiles in which i have to receive the message string and then split that string in parts(each parts containing 2 characters).I am able to do up-to this much. And after this now i have to check the checkbox depending on the string. For ex-if my String is a1a2a3 then i have splited into a1, a2 & a3.Now i have a screen of 5 vertical check boxes.where 1st box represent a1,2nd one a2 and so on the 5th one representing a5. Now after receieving the message(a1a2a3) i want that when i open the checkbox page then i should get the first three checkboxes to be checked.

On testing with debugger attached i found that i am able to receive the message and also i am able to split the message string but i am not able to apply check on the check开发者_JS百科boxes.

Plz help me out.its very urgent. Thanks in advance:)


Do this:

    CheckBox checkBox;
    if(A.a1==1){
        checkBox = findViewById(R.id.Checkbox_a1);
        checkBox.setChecked(true);
    }

Whats the rocket science in this? Have u added the tag:

     setContentView(R.layout.main);
0

精彩评论

暂无评论...
验证码 换一张
取 消