Doubt about extension development

Hello guys.
Recently I wanted to learn to create extensions, so I started learning the basics of Java, and now I want to create my first extension, and I am trying to make a basic extension to get ringtone title.

I wrote a simple file using rush, but I am unable to build the extension.

package io.Teste;

import android.content.Context;
import java.lang.Object;

public class Teste extends AndroidNonvisibleComponent {
  public Teste(ComponentContainer container) {
	@SimpleFunction(description = "Returns the sum of the given two integers.")
	public int Sum(int a, int b) {
	return a + b;
	@SimpleFunction(description = "Return the ringtone title.")
	public String getTitle (Context context) {
	return getTitle;

What I am doing wrong?
Error Output:

Java != Java Android
Learning Java means that you have a language to access Android APIs.

The thing wrong here is that what exactly getTitle is?


The problem is here.
You can’t take the Context variable as a parameter in your extension. You will have to make the context variable wantin your java file and fill it in your class’s super constructor like this

And you can use this anywhere wherever you want

P.S as @vknow360 said getTitle is not a variable or a parameter so you can’t return it.It will be the another error when you will solve the context error.


Thank you for the answers,
I am scrapping some open source extensions to understood better how the code works, maybe I made a step bigger than my legs :sweat_smile:

Sorry I didn’t understand 100% what you are saying. What do you mean by super constructor?

1 Like

Here is your super constructor

Jusr add my this line below container.$form after making the private context variable

And you can use this context variable

Like this?

But the problem is still not fixed.
As I said above

P.S you have not created the private Context variable yet

1 Like

Yeah, now I will try to solve this, thanks for answering and helping me.

1 Like

I think these things can be easily learnt by exploring open source extensions and basic Java tutorials.
Otherwise someday someone will just post "How to create a class? What is Java? How to create extension without learning Java? "


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.