User Tools

Site Tools


import_a_script_directly_into_ll

**This is an old revision of the document!** ----

A PCRE internal error occured. This might be caused by a faulty plugin

**//This is only a preview. The Repository Importer is not yet avialable.//** In the Activity which wants to import a script add: <sxh java;>@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent(); if(intent.hasExtra("loadedScriptId")){ int id = intent.getIntExtra("loadedScriptId",-1); //do something with the ID } else{ //do normal create } } void loadScript(String code,String name,int flags){ Intent intent = new Intent("net.pierrox.lightning_launcher.script.IMPORT"); List<ResolveInfo> list = getPackageManager().queryIntentServices(intent, PackageManager.MATCH_DEFAULT_ONLY); if(list.size()==0) { new AlertDialog.Builder(this) .setTitle("Repository Importer missing") .setMessage("This action requires the Repository Importer to be installed. Do you wish to install it?") .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); } }) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { dialogInterface.dismiss(); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=com.trianguloy.llscript.repository"))); } }); } else { intent.putExtra("code",code); intent.putExtra("name",name); intent.putExtra("flags",flags); intent.putExtra("receiver",getComponentName().flattenToString()); startService(intent); } } </sxh> In your AndroidManifest.xml: <sxh XML;> <uses-permission android:name="net.pierrox.lightning_launcher.IMPORT_SCRIPTS"/> </sxh> Then you can simply call loadScript in your Activity with valid data. This requires the Repository Importer to be installed on the device.

import_a_script_directly_into_ll.1422796645.txt.gz · Last modified: 2015/02/01 13:17 by lm13