Answer: The primary constructor is part of the class header. Unlike Java, you don't need to declare a constructor in the body of the class. Here's an example:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright (C) 2017 The Android Open Source Project | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// API access key from Google API's Console | |
define( 'API_ACCESS_KEY', 'AIzaSyDD5cwKE6O252bVA766Lyo2cQhG7RbShWA' ); | |
$registrationIds = array("erKXJiDIdiY:APA91bE3N0Bfh6e7tpIT2qcHBD_vqg6ObMQHyrbXEAf6MQqeHcGSauArLzoQRvWb7VpHY_hReEdfw3WxU5Ybk95dWnGT2KAQmC9cHAajuDQx5kJu1Ic2QJKuu3vYNtuRAo6edfuMrbJj" ); | |
// prep the bundle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
dependencies { | |
classpath 'com.android.tools.build:gradle:0.5.6' | |
} | |
} | |
task wrapper(type: Wrapper) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// I forked this code from- http://www.piwai.info/chatheads-basics/ | |
// Chat head is displayed from a service. | |
// uses a permission: <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> | |
// This is a service so it needs to be declared in manifest: <service android:name=".ChatHeadService" /> | |
// Whenever you need to display the chat head, just start the service | |
// example: startService(new Intent(context, ChatHeadService.class)); | |
public class ChatHeadService extends Service { | |
private WindowManager windowManager; |