Skip to main content

How to Base64 decode a string with decodeURI in Nativescript angular


home.component.html
<ActionBar title="Home" class="action-bar">
</ActionBar>
<ScrollView class="page">
<StackLayout class="home-panel">
<Button text="Button" (tap)="onButtonTap()"></Button>
</StackLayout>
</ScrollView>

home.component.ts
import { Component, OnInit } from "@angular/core";

declare var android;
declare var java: any;

@Component({
selector: "Home",
moduleId: module.id,
templateUrl: "./home.component.html",
styleUrls: ['./home.component.css']
})


export class HomeComponent implements OnInit {
public ab = "JTNDcCUzRSUzQ3NwYW4lMjBzdHlsZSUzRCUyMmNvbG9yJTNBJTIwcmdiKDM0JTJDJTIwMzQlMkMlMjAzNCklM0IlMjBmb250LWZhbWlseSUzQSUyMGFyaWFsJTJDJTIwc2Fucy1zZXJpZiUzQiUyMiUzRVRlc3QlMjBjcmlja2V0JTIwaXMlMjB0aGUlMjBsb25nZXN0JTIwZm9ybSUyMG9mJTIwdGhlJTIwc3BvcnQlMjBvZiUyMGNyaWNrZXQlMjBhbmQlMjBpcyUyMGNvbnNpZGVyZWQlMjBpdHMlMjBoaWdoZXN0JTIwc3RhbmRhcmQuJTIwVGVzdCUyMG1hdGNoZXMlMjBhcmUlMjBwbGF5ZWQlMjBiZXR3ZWVuJTIwbmF0aW9uYWwlMjByZXByZXNlbnRhdGl2ZSUyMHRlYW1zJTI2bmJzcCUzQiUzQyUyRnNwYW4lM0UlM0NiciUzRSUzQyUyRnAlM0U=";


onButtonTap(): void {
const test = android.util.Base64.decode(this.ab, android.util.Base64.DEFAULT);
const text = decodeURI(new java.lang.String(test));
console.log("Button answer " + text);
}


constructor() { 
}


ngOnInit(): void {
}
}

Comments

Popular posts from this blog

NgFor Directive with Index in nativescript angular

home.component.ts import { Component, OnInit } from "@angular/core"; @Component({ selector: "Home", moduleId: module.id, templateUrl: "./home.component.html", styleUrls: ['./home.component.css'] }) export class HomeComponent implements OnInit { silabusList = [ { "subject": "tamil" }, { "subject": "hindi" }, {"subject": "english"}, { "subject": "spanish" }, ] constructor() { } ngOnInit(): void { } btn(args) { console.log("index subje " + args) } } home.component.html <ActionBar title="Home" class="action-bar"> </ActionBar> <ScrollView class="page"> <StackLayout class="home-panel"> <StackLayout *ngFor="let item of silabusList ; let i = index"> <Label [text]="item.subject" (tap)="btn(i)" ></Label> </...

Using Icons from graphemica/whatsapp in nativescript angular

Using graphemica Icons -  1. Open the below link http://graphemica.com/%F0%9F%93%8E 2. Copy the icon then paste in the label text as mentioned, <Label text="📎" horizontalAlignment="center"></Label> Using Whatsapp Icons -  1. Just open the whatsapp web,  https://web.whatsapp.com/ 2. Copy the icons/symbols then paste it in the label text  as mentioned, <Label horizontalAlignment=" center " text="😍"></Label>

Dividing screen into multiple fragments for design home screen menus in nativescript angular

home.component.ts import { Component, OnInit } from "@angular/core"; @Component({ selector: "Home", moduleId: module.id, templateUrl: "./home.component.html", styleUrls: ['./home.component.css'] }) export class HomeComponent implements OnInit { onButtonTap(): void { console.log("Button was pressed"); } constructor() { } ngOnInit(): void { } } home.component.html <ActionBar title="Home" class="action-bar"> </ActionBar> <GridLayout height="90%" width="95%" rows="*,*" columns="*,*"> <StackLayout class="a" row="0" col="0"> <Button text="Button 1" (tap)="onButtonTap()"></Button> </StackLayout> <StackLayout class="b" row="0" col="1"> <Button text="Button 2" (tap)="onButtonTap()"...