d.Use the setFirstQuestion method in the constructor to specify the first question in the sub-interview.

The following setFirstQuestion code in the SampleInterview example specifies the first question.

public class SampleInterview extends Interview { public SampleInterview(MidpTckBaseInterview parent)

throws Fault { super(parent, "sample"); setResourceBundle("i18n"); setHelpSet("help/sampleInterview"); setFirstQuestion(first);

}

}

e.Specify the question type.

The Question class is a base class that provides the different types of questions required to build the sub-interview. In the example, the question gets string information. Therefore, the example must use the

StringQuestion type.

The following code in the SampleInterview example specifies the

StringQuestion type.

StringQuestion first = new StringQuestion(this, "hello")

In the example, hello is a unique id that identifies the specific question name. This name is used in the properties and map files.

32 Java ME TCK Framework Developer’s Guide • July 2007

Page 52
Image 52
Sun Microsystems 1.2 manual Specify the question type