i am new to this community just 1-2 weeks ago i came to this community but i am developing 3 apps for a year,i actually want to learn a bit off java,to develop extension.
before starting with my question i would like to thank this wonderfull conversation
Getting error in extension building - Extension Development - MIT App Inventor Community
from where i developed the code a bit
after reffering from android studio
at this para it says the code for positioning:- click here
i made the code with gravity and a new pakage imported
import android.content.Context;
import android.util.Log;
import com.google.appinventor.components.annotations.;
import com.google.appinventor.components.runtime.;
import com.google.appinventor.components.annotations.DesignerComponent;
import com.google.appinventor.components.annotations.SimpleObject;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.annotations.SimpleEvent;
import com.google.appinventor.components.annotations.SimpleProperty;
import com.google.appinventor.components.common.ComponentCategory;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.AndroidViewComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.EventDispatcher;
import android.widget.Toast;
import android.content.Context;
import android.view.Gravity;
@DesignerComponent(version = 1, description = “This Extension was created with the AppyBuilder Code Editor.
” +
“Create your own here:
https://editor.appybuilder.com
”,
category = ComponentCategory.EXTENSION,
nonVisible = true, iconName = “http://appyBuilder.com/extensions/icons/extension.png”)
@SimpleObject(external = true)
public class Simple_toast extends AndroidNonvisibleComponent {
private ComponentContainer container;
/**
* @param container container, component will be placed in
*/
public Simple_toast(ComponentContainer container) {
super(container.$form());
this.container = container;
}
@SimpleFunction(description = “Show toast message,give xaxis,yaxis,message”)
public void ShowToastMessage(String message, int x, int y) {
//YOUR ACTIVITY HERE
Toast toast = Toast.makeText(container.$context(),message,Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, x, y);
toast.show();
}
@SimpleFunction(description = “Show toast message,give message”)
public void ShowsimpleToastMessage(String message) {
//YOUR ACTIVITY HERE
Toast toast1 = Toast.makeText(container.$context(),message,Toast.LENGTH_SHORT);
toast1.show();
}
}
later i want to add the background colour ,text colour,custom toast (image+text)
but here i have a problem i neither know the packages name i need to import nor the code
so here i need your help
can some one solve the issue
these to web page i referred
and i think the answer is there
but still i dont understand how to implement it in my app