I need a Try catch extension

Hi guys

I wonder if anyone knows of any extensions similar to try catch. If anyone has, send it to me. Thanks.

1 Like

Something like this?

try {
//my code
} catch(Exception e) {
//Code to be executed when an error occurs while executing the try block code.Tge exception would be stored in the e variable.

Or do you want a new block for this,then see rogerio_rios answer :blush:

1 Like


Good …

It could be in the category #I Want

É verdade, desculpa

1 Like

Do not worry. Just write in English. And you don’t need to mark it as a solution. Just include the #Iwant tag



@Mohamed_Tamer It’s a good block to have ln Kodular, don’t you think? :thumbsup:

Good that it was included native in Kodular, right?
But I’m not a Java programmer … :no_mouth:

That would be a good option :+1: Just the category and title made me think that he is asking about an extension :sweat_smile:
Btw, shouldn’t all of the blocks do that itself, the Error Occurred event is raised when an error occurs :thinking:

1 Like

Ok … I didn’t think you were wrong :thumbsup: … don’t worry … :thumbsup: I just liked the idea of ​​the author of the post and suggested that the author put #iwant.

Yes, the blocks should have … or can’t It ?

Ok… We wouldn’t need Try … catch … right?

1 Like

We might need it for example for extensions that doesn’t use it

1 Like

Exactly ! Perfect reasoning! :clap:t2:
Thank You !

Sorry, I’m new here. :sweat_smile:

1 Like

use my Test extensions java code.

package aryan.gupta.Uninstall;

import android.app.Activity;
import android.content.Intent;
import android.content.Context;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import com.google.appinventor.components.annotations.*;
import com.google.appinventor.components.common.*;
import com.google.appinventor.components.runtime.*;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import java.io.File;
import java.lang.Object;

@SimpleObject(external = true)
@DesignerComponent(category = ComponentCategory.EXTENSION, description = "Made by Aryan Gupta", nonVisible = true, version = 1)
@UsesPermissions(permissionNames = "android.permission.REQUEST_DELETE_PACKAGES")
public class Uninstall extends AndroidNonvisibleComponent {

    private ComponentContainer container;
    private Context context;

    public Uninstall(ComponentContainer container) {
    this.container = container;

    public void Uninstall(String packageName){
try {
    Intent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE);
} catch (Exception e) {
//here you can call a event for Error Occurred and many more.


and you can use GetApk extension’s java code.