Free Huawei H14-231_V1.0 Exam Braindumps (page: 29)

What events can the next piece of code handle?

  1. public class CustonLomponent extends Componentimplements Component.DrawTask,Component.EstimateSizeListener,Component.TouchEventListener {
    ......
    public CustomComponent (Context context){
    ...
    Set up a TouchEvent to respond to events setlouchEventListener(this);
    }
    ...
    @Override public boolean onTouchEvent(Component component,TouchEvent touchEvent){
    switch (touchEvent.getAction() {
    case TouchEvent.PRIMARY_POINT_DOWN:
    circ1ePaint.setColor(Color.GREEN);
    invalidate() ;
    break;
    case TouchEvent.PRIMARY_POINT_UP:
    circlePaint.setColor(Color.YELLOWV);
    invalidate();
    break ;
    }

    return false;
    }
    }
    Both DOWN and UP events can be handled normally
  2. Neither event can be processed
  3. can only handle DOWN events
  4. Only UP events can be processed

Answer(s): A



When a developer subscribes to a public event, he processes the public event in the onReceiveEvent() callback function and writes the following code.

EventRunner runner = EventRunner.create();

MyEventHandler myHandler = new

MyEventHandler(rurner);

@Override public void onReceiveEvent(CommonEventData commonEventData){

final AsyncCommonEventResult result=goAsyncCommonEvent Runnable task = new

Runnable(){

@override pub1ic void run {

......

The action to be performed, defined by the developer result.finishCommonEvent();

}

};

myHandler.postTask(task);

}

  1. Gives subscribers permissions
  2. implements asynchronous operations, which solves the problem that time-consuming operations cannot be performed on onReceiveEvent
  3. sets the priority of ordered public events
  4. The publisher has the permission to publish sticky public events

Answer(s): B



How do I define the permissions correctly when a developer needs to customize the permissions for the Harmony OS third-party application?

  1. "module": {
    "reqPermissions": [
    {
    "name":"com.myability.permission.MYPERMISSION "
    "grantMode":"system_grant",
    "availableScope": ["signatures"]
    }
    }
  2. "module": {
    "defPermissions": [
    "name":"com.myability.permission.INTERNET"
    "grantMode":"user_grant"
    "availableScope": ["signatures"]
    }

    }
  3. "module": {
    "defPermissions": [
    {
    "name":"com.myability.permission.INTERNET"
    "grantMode":"system_grant"
    "availableScope": ["signatures"]
    }
    }
  4. "module": {
    "defPermissions": [
    {
    "name":"com.myability.permission.MYPERMISSION",
    "grantMode":"system_grant"
    "availableScope": ["signatures"]
    }
    }

Answer(s): D



In the Page Ability lifecycle of HarmonyOS, when the system creates a Page instance for the first time, which of the following callback methods will be triggered first?

  1. onStart()
  2. onActive()
  3. onInactive()
  4. onStop()

Answer(s): A



Viewing page 29 of 176
Viewing questions 113 - 116 out of 699 questions



Post your Comments and Discuss Huawei H14-231_V1.0 exam prep with other Community members:

H14-231_V1.0 Exam Discussions & Posts