Skip to content

Instantly share code, notes, and snippets.

@saknarak
Created April 26, 2017 13:24
Show Gist options
  • Save saknarak/07ce030987524513f3fae90746894f79 to your computer and use it in GitHub Desktop.
Save saknarak/07ce030987524513f3fae90746894f79 to your computer and use it in GitHub Desktop.
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
import android.view.View;
import android.net.Uri;
import android.content.Intent;
public class TestActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView view = (TextView)findViewById(R.id.test_view);
view.setOnClickListener(new View.OnClickListener(){
public void onClick(View view){
Uri packageUri = Uri.parse("package:org.klnusbaum.test");
Intent uninstallIntent =
new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri);
startActivity(uninstallIntent);
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment