I have a problem with Simple Android Activity Lifecycle - kotlin

Could you explain me, why both of my Android 12 and Android 8 does not call method onSaveInstanceState()
class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater).also { setContentView(it.root) }
Log.d("AAAAA", "onCreate")
binding.buttonSet.setOnClickListener {
binding.tvData.text = "This is my meesage"
}
}
override fun onStart() {
Log.d("AAAAA", "onStart")
super.onStart()
}
override fun onResume() {
Log.d("AAAAA", "onResume")
super.onResume()
}
override fun onPause() {
Log.d("AAAAA", "onPause")
super.onPause()
}
override fun onStop() {
Log.d("AAAAA", "onStop")
super.onStop()
}
override fun onDestroy() {
Log.d("AAAAA", "onDestroy")
super.onDestroy()
}
override fun onRestart() {
Log.d("AAAAA", "onRestart")
super.onRestart()
}
override fun onSaveInstanceState(outState: Bundle, outPersistentState: PersistableBundle) {
super.onSaveInstanceState(outState, outPersistentState)
Log.d("AAAAA", "onSaveInstanceState")
}
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
super.onRestoreInstanceState(savedInstanceState)
Log.d("AAAAA", "onRestoreInstanceState")
}
}
My Logcat:
2022-07-16 11:37:30.344 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onCreate
2022-07-16 11:37:30.346 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onStart
2022-07-16 11:37:30.346 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onRestoreInstanceState
2022-07-16 11:37:30.347 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onResume
2022-07-16 11:37:31.458 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onPause
2022-07-16 11:37:31.460 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onStop
2022-07-16 11:37:31.461 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onDestroy
2022-07-16 11:37:31.518 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onCreate
2022-07-16 11:37:31.519 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onStart
2022-07-16 11:37:31.520 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onRestoreInstanceState
2022-07-16 11:37:31.520 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onResume
2022-07-16 11:40:26.012 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onPause
2022-07-16 11:40:26.015 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onStop
2022-07-16 11:40:26.016 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onDestroy
2022-07-16 11:40:26.076 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onCreate
2022-07-16 11:40:26.078 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onStart
2022-07-16 11:40:26.078 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onRestoreInstanceState
2022-07-16 11:40:26.079 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onResume
2022-07-16 11:40:27.013 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onPause
2022-07-16 11:40:27.014 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onStop
2022-07-16 11:40:27.015 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onDestroy
2022-07-16 11:40:27.067 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onCreate
2022-07-16 11:40:27.069 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onStart
2022-07-16 11:40:27.070 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onRestoreInstanceState
2022-07-16 11:40:27.070 29235-29235/com.elene.activitylifecycle23 D/AAAAA: onResume
My Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.elene.activitylifecycle23">
<application
android:allowBackup="true"
android:dataExtractionRules="#xml/data_extraction_rules"
android:fullBackupContent="#xml/backup_rules"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.ActivityLifecycle23"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
My XML
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="#+id/tvData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="#+id/buttonSet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.636" />
</androidx.constraintlayout.widget.ConstraintLayout>

It was a problem with onSaveInstanceState() method. In this occasion we should use onSaveInstanceState(outState: Bundle)

Related

API Gateway Ocelot not redirecting

Im using newest Ocelot for net6.
Trying to test out a simple redirect without SSL to get a grasp of it.
{
"Routes": [
{
"DangerousAcceptAnyServerCertificateValidator": true,
"DownstreamPathTemplate": "/nft",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "http://realdnstest.com",
"Port": 80
}
],
"UpstreamPathTemplate": "/nft",
"UpstreamHttpMethod": [
"Get"
]
}
],
"GlobalConfiguration": {
"BaseUrl": "http://localhost:5000"
}
}
Program.cs:
namespace OcelotBasic
{
public class Program
{
public static void Main(string[] args)
{
new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.ConfigureAppConfiguration((hostingContext, config) =>
{
config
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
.AddJsonFile("appsettings.json", true, true)
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
.AddJsonFile("ocelot.json")
.AddEnvironmentVariables();
})
.ConfigureServices(s => {
s.AddOcelot();
})
.ConfigureLogging((hostingContext, logging) =>
{
})
.UseIISIntegration()
.Configure(app =>
{
app.UseOcelot().Wait();
})
.Build()
.Run();
}
}
}
The app is running on localhost:5000 but won't redirect localhost:5000/nft to http://realdnstest.com/nft
Is there anything being missed ?

Does Vue Cli 4.4.6 scaffold ES2020 into the project

If I run vue create my-new-app using the latest Vue Cli (currently version 4.4.6) will all the new ES2020 features be implemented? (I've tested "optional chaining" and seem to be able to use that)
If so, how can I tell from the scaffolded code? I'm seeing #vue/cli-plugin-babel/preset in babel.config.js, does that do it?
I believe ES2020 has been officially completed. Let me know if that's incorrect.
The Babel plugins indeed allow compilation of ES2020 features. You can view which plugins are in use by enabling debug before running the build:
// babel.config.js
module.exports = {
presets: [
// BEFORE:
// '#vue/cli-plugin-babel/preset'
['#vue/cli-plugin-babel/preset', { debug: true }]
]
}
The debug output will look like this:
⠇ Building for production...#babel/preset-env: `DEBUG` option
Using targets:
{
"android": "81",
"chrome": "80",
"edge": "18",
"firefox": "76",
"ie": "11",
"ios": "12.2",
"opera": "67",
"safari": "13",
"samsung": "10.1"
}
Using modules transform: false
Using plugins:
proposal-nullish-coalescing-operator { "edge":"18", "ie":"11", "ios":"12.2", "safari":"13", "samsung":"10.1" }
proposal-optional-chaining { "edge":"18", "ie":"11", "ios":"12.2", "safari":"13", "samsung":"10.1" }
proposal-json-strings { "edge":"18", "ie":"11" }
proposal-optional-catch-binding { "edge":"18", "ie":"11" }
transform-parameters { "ie":"11" }
proposal-async-generator-functions { "edge":"18", "ie":"11" }
proposal-object-rest-spread { "edge":"18", "ie":"11" }
transform-dotall-regex { "edge":"18", "firefox":"76", "ie":"11" }
proposal-unicode-property-regex { "edge":"18", "firefox":"76", "ie":"11" }
transform-named-capturing-groups-regex { "edge":"18", "firefox":"76", "ie":"11" }
transform-async-to-generator { "ie":"11" }
transform-exponentiation-operator { "ie":"11" }
transform-template-literals { "ie":"11", "ios":"12.2" }
transform-literals { "ie":"11" }
transform-function-name { "edge":"18", "ie":"11" }
transform-arrow-functions { "ie":"11" }
transform-classes { "ie":"11" }
transform-object-super { "ie":"11" }
transform-shorthand-properties { "ie":"11" }
transform-duplicate-keys { "ie":"11" }
transform-computed-properties { "ie":"11" }
transform-for-of { "ie":"11" }
transform-sticky-regex { "ie":"11" }
transform-unicode-escapes { "ie":"11" }
transform-unicode-regex { "ie":"11" }
transform-spread { "ie":"11" }
transform-destructuring { "ie":"11" }
transform-block-scoping { "ie":"11" }
transform-typeof-symbol { "ie":"11" }
transform-new-target { "ie":"11" }
transform-regenerator { "ie":"11" }
syntax-dynamic-import { "android":"81", "chrome":"80", "edge":"18", "firefox":"76", "ie":"11", "ios":"12.2", "opera":"67", "safari":"13", "samsung":"10.1" }
syntax-top-level-await { "android":"81", "chrome":"80", "edge":"18", "firefox":"76", "ie":"11", "ios":"12.2", "opera":"67", "safari":"13", "samsung":"10.1" }
Using polyfills with `usage` option:
⠏ Building for production...
[/Users/tony/src/tmp/vue-tmp7/src/main.js] Based on your code and targets, core-js polyfills were not added.
⠴ Building for production...#babel/preset-env: `DEBUG` option
Using targets:
{
"android": "81",
"chrome": "80",
"edge": "18",
"firefox": "76",
"ie": "11",
"ios": "12.2",
"opera": "67",
"safari": "13",
"samsung": "10.1"
}
Using modules transform: false
Using plugins:
proposal-nullish-coalescing-operator { "edge":"18", "ie":"11", "ios":"12.2", "safari":"13", "samsung":"10.1" }
proposal-optional-chaining { "edge":"18", "ie":"11", "ios":"12.2", "safari":"13", "samsung":"10.1" }
proposal-json-strings { "edge":"18", "ie":"11" }
proposal-optional-catch-binding { "edge":"18", "ie":"11" }
transform-parameters { "ie":"11" }
proposal-async-generator-functions { "edge":"18", "ie":"11" }
proposal-object-rest-spread { "edge":"18", "ie":"11" }
transform-dotall-regex { "edge":"18", "firefox":"76", "ie":"11" }
proposal-unicode-property-regex { "edge":"18", "firefox":"76", "ie":"11" }
transform-named-capturing-groups-regex { "edge":"18", "firefox":"76", "ie":"11" }
transform-async-to-generator { "ie":"11" }
transform-exponentiation-operator { "ie":"11" }
transform-template-literals { "ie":"11", "ios":"12.2" }
transform-literals { "ie":"11" }
transform-function-name { "edge":"18", "ie":"11" }
transform-arrow-functions { "ie":"11" }
transform-classes { "ie":"11" }
transform-object-super { "ie":"11" }
transform-shorthand-properties { "ie":"11" }
transform-duplicate-keys { "ie":"11" }
transform-computed-properties { "ie":"11" }
transform-for-of { "ie":"11" }
transform-sticky-regex { "ie":"11" }
transform-unicode-escapes { "ie":"11" }
transform-unicode-regex { "ie":"11" }
transform-spread { "ie":"11" }
transform-destructuring { "ie":"11" }
transform-block-scoping { "ie":"11" }
transform-typeof-symbol { "ie":"11" }
transform-new-target { "ie":"11" }
transform-regenerator { "ie":"11" }
syntax-dynamic-import { "android":"81", "chrome":"80", "edge":"18", "firefox":"76", "ie":"11", "ios":"12.2", "opera":"67", "safari":"13", "samsung":"10.1" }
syntax-top-level-await { "android":"81", "chrome":"80", "edge":"18", "firefox":"76", "ie":"11", "ios":"12.2", "opera":"67", "safari":"13", "samsung":"10.1" }
Using polyfills with `usage` option:
[/Users/tony/src/tmp/vue-tmp7/src/App.vue] Based on your code and targets, core-js polyfills were not added.
⠧ Building for production...
[/Users/tony/src/tmp/vue-tmp7/src/components/HelloWorld.vue] Based on your code and targets, core-js polyfills were not added.
Tested with Node 14, Vue CLI 4.4.6, and #babel/preset-env 7.10.3 on macOS Catalina
ES2020 features supported as of Vue CLI 4.4.6
optional chaining
nullish coalescing
Promise.prototype.allSettled
String.prototype.matchAll
private class fields
dynamic imports enhancement
BigInt - might require an ESLint config to avoid a lint error when using the constructor

IBM Worklight - "Failed to parse the payload from backend"

Must any URL of RSS resource end with ".xml" when used in Worklight?
For example: http://www.youku.com/user/rss/id/24645394
I tried to save the above as an XML file, then place it in my localhost. It works. However, the below code doesn't work... I get the following invocation result.
Do you you have solution about my case?
{
"errors": [
"Premature end of file.",
"Failed to parse the payload from backend (procedure: HttpRequest)"
],
"info": [
],
"isSuccessful": false,
"responseHeaders": {
"Accept-Ranges": "bytes",
"Age": "0",
"Cache-Control": "no-store, no-cache, must-revalidate",
"Connection": "close",
"Content-Length": "0",
"Content-Type": "text\/html; charset=utf-8",
"Date": "Mon, 07 Apr 2014 16:24:45 GMT",
"Server": "Varnish",
"X-Cache": "Miss from 1.w.b28"
},
"responseTime": 2452,
"statusCode": 404,
"statusReason": "Unknown virtual host",
"totalTime": 2465,
"warnings": [
]
}
News.xml
<?xml version="1.0" encoding="UTF-8"?>
<wl:adapter name="News"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wl="http://www.worklight.com/integration"
xmlns:http="http://www.worklight.com/integration/http">
<displayName>News</displayName>
<description>News</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>www.youku.com</domain>
<port>80</port>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
<procedure name="getStories" />
<procedure name="getStoriesFiltered" />
</wl:adapter>
News-impl.js
function getStories(interest) {
path = getPath(interest);
var input = {
method : 'get',
returnedContentType : 'xml',
path : path
};
return WL.Server.invokeHttp(input);
}
function getStoriesFiltered(interest) {
path = getPath(interest);
var input = {
method : 'get',
returnedContentType : 'xml',
path : path,
transformation : {
type : 'xslFile',
xslFile : 'filtered.xsl'
}
};
return WL.Server.invokeHttp(input);
}
function getPath(interest) {
if (interest == undefined || interest == '') {
interest = '/user/rss/id/24645394/';
}else {
interest = '/user/rss/id/'+interest;
}
return interest;
}
filtered.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:h="http://www.w3.org/1999/xhtml">
<xsl:output method="text"/>
<xsl:template match="/">
{
'Items': [
<xsl:for-each select="rss/channel/item">
{
'title': '<xsl:value-of select="title"/>',
'link': '<xsl:value-of select="link"/>'
},
</xsl:for-each>
]
}
</xsl:template>
</xsl:stylesheet>
add host header:
var input = {
method : 'get',
returnedContentType : 'xml',
path : path,
headers: {
"Host":"www.youku.com"
}
};

How to set up splash screen and startup screen on Sencha Touch 2?

I'm not sure splash screen and startup screen is same.
I build app for android use Phonegap.
I put code java when I build app android use phonegap:
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.setIntegerProperty("splashscreen", R.drawable.splash);
// Set by <content src="index.html" /> in config.xml
super.loadUrl(Config.getStartUrl(),5000);
//super.loadUrl("file:///android_asset/www/index.html")
}
And Startup Screen I put code in app.js:
Ext.Loader.setPath({
'Ext': 'touch/src'
});
Ext.application({
name: 'Project-catalog',
requires: [
'Ext.MessageBox'
],
controllers: [
'Main' , 'searchCon'
],
models: [
'appsModel' , 'catModel'
],
stores: [
'appsStore' , 'catStore'
],
views: [
'Main' , 'Home' , 'Navigation' , 'showSearchCategory' , 'SearchQ'
],
icon: {
'57': 'resources/icons/Icon.png',
'72': 'resources/icons/Icon~ipad.png',
'114': 'resources/icons/Icon#2x.png',
'144': 'resources/icons/Icon~ipad#2x.png'
},
isIconPrecomposed: true,
startupImage: {
'320x460': 'resources/startup/320x460.jpg',
'640x920': 'resources/startup/640x920.png',
'768x1004': 'resources/startup/768x1004.png',
'748x1024': 'resources/startup/748x1024.png',
'1536x2008': 'resources/startup/1536x2008.png',
'1496x2048': 'resources/startup/1496x2048.png'
},
phoneStartupScreen:'resources/startup/640x920.png',
tabletStartupScreen: 'resources/startup/748x1024.png',
launch: function() {
// Destroy the #appLoadingIndicator element
// Ext.fly('appLoadingIndicator').destroy();
// Initialize the main view
Ext.Viewport.add(Ext.create('Project-catalog.view.Main'));
},
onUpdated: function() {
Ext.Msg.confirm(
"Application Update",
"This application has just successfully been updated to the latest version. Reload now?",
function(buttonId) {
if (buttonId === 'yes') {
window.location.reload();
}
}
);
}
});
When I build app in emulator splash screen have show.When splash screen destroy.App is have background color bluesky so show apps
I put code wrong or not ?
The splash screen is native stuff. Phonegap provides a bridge api to handle it via JS:
navigator.splashscreen.show();
navigator.splashscreen.hide();
You should probably call navigator.splashscreen.hide() in your Ext.application :: launch()
Take a look at:
http://docs.phonegap.com/en/2.9.0/cordova_splashscreen_splashscreen.md.html
hope it helps

Settings on top bezel bb10

UPDATE
I wanna implement the setting by swiping the top bezel, here's my code am I doing this right? Currently this doesn't work. I wanna know how to implement it. Where should I put the code for it, and what do I lack of so that it'll work?
import bb.cascades 1.0
NavigationPane {
//property variant menu;
Menu.definition: MenuDefinition {
settingsAction: SettingsActionItem {
imageSource: "asset:///images/navbar_icon_settings.png"
onTriggered: {
cppObj.onSettingsClicked();
}
}
actions: [
ActionItem {
title: "Action 1"
imageSource: "asset:///images/navbar_icon_settings.png"
onTriggered: {
cppObj.onSettingsClicked();
}
}
]
}
firstPage: Page {
Container {
background: Color.create("#f9f7f2");
layout: StackLayout {}
// Container for holding the title
Container {
horizontalAlignment: HorizontalAlignment.Center
layout: DockLayout {}
ImageView {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
imageSource: "asset:///images/navigation_bar.png"
}
/*Container {
horizontalAlignment: HorizontalAlignment.Right
rightPadding: 30
topPadding: 40
layout: DockLayout {}
ImageButton {
id: btnsettings
verticalAlignment: VerticalAlignment.Center
defaultImageSource: "asset:///images/navbar_icon_settings.png"
onClicked: {
// show settings page when the button is clicked
cppObj.onSettingsClicked();
}
}
}*/
}
Container {
topPadding: 20
leftPadding: 20
rightPadding: 20
bottomPadding: 20
background: Color.create("#F4E9E1");
horizontalAlignment: HorizontalAlignment.Fill
layout: StackLayout {}
Label {
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: HorizontalAlignment.Left
text: cppObj.name
textStyle {
// fontFamily: FontStyle.Default.Myriad
// fontSize: 36
color: Color.create("#60323C")
}
}
}
Container {
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: HorizontalAlignment.Center
layout: DockLayout {}
Divider {}
ScrollView {
scrollViewProperties {
scrollMode: ScrollMode.Vertical
}
/* ImageView {
id: listviewbackground
verticalAlignment: VerticalAlignment.Center
horizontalAlignment: HorizontalAlignment.Center
scalingMethod: ScalingMethod.Fill
imageSource: "asset:///images/list_view_cell.png"
}*/
ListView {
id: lvprojects
dataModel: cppObj.model()
listItemComponents: [
ListItemComponent {
type: "item"
Container {
horizontalAlignment: HorizontalAlignment.Center
layout: DockLayout {}
touchPropagationMode: TouchPropagationMode.Full;
StandardListItem {
title:ListItemData.desc
}
}
}
]
onTriggered: {
var selectedItem = dataModel.data(indexPath);
onClicked: {
// show issue's comment page when the button is clicked
cppObj.onIssueClicked(selectedItem.name);
}
}
}
}
}
}
actions: [
ActionItem {
title: qsTr ("Add Issue")
imageSource: "asset:///images/actionbar_icon_add.png"
ActionBar.placement: ActionBarPlacement.OnBar
onTriggered: {
cppObj.onAddIssuesClicked();
}
},
ActionItem {
title: qsTr ("Issues")
imageSource: "asset:///images/actionbar_icon_issues.png"
ActionBar.placement: ActionBarPlacement.OnBar
onTriggered: {
cppObj.onIssuesClicked();
}
},
ActionItem {
title: qsTr ("Members")
imageSource: "asset:///images/actionbar_icon_members.png"
ActionBar.placement: ActionBarPlacement.OnBar
onTriggered: {
cppObj.onMembersClicked();
}
}
]
}
/*attachedObjects: [
ComponentDefinition {
id: settingsPage
source: "topsettings.qml"
}
]
onCreationCompleted: {
// Create the app menu for the cookbook.
menu = settingsPage.createObject();
}
onPopTransitionEnded: {
// Transition is done destroy the Page to free up memory.
page.destroy();
}*/
}
And here's the topsettings.qml
MenuDefinition {
settingsAction: SettingsActionItem {
imageSource: "asset:///images/navbar_icon_settings.png"
onTriggered: {
cppObj.onSettingsClicked();
}
}
Settings is not displayed:
Your code looks good: the only issue is that you try to define your Menu.definition in a Page, but you should be defining it in a Pane. See here for example: https://github.com/Kernald/tt-rss-bb10/blob/master/assets/main.qml#L9
By the way, note that you have predefined actions for Help and Settings. See the link before, I used them too.
Let's say you have the NavigationPane as the QML document loaded first upon application launch, so that's should be placed in MenuDefinition like that:
NavigationPane {
Menu.definition: MenuDefinition {
helpAction: HelpActionItem {
onTriggered: {
}
}
actions: [
ActionItem {
title: "Action 1"
imageSource: "asset:///images/ic_action1.png"
onTriggered: {
}
},
ActionItem {
title: "Action 2"
imageSource: "asset:///images/ic_action2.png"
onTriggered: {
}
}
]
}
firstPage: Page {
}
}
Note, that there might be up to 4 elements and HelpActionItem as well SettingsActionItem are already defined if you want to implement similar menu entries.