diff --git a/es/tutorials/android_studio/index.html b/es/tutorials/android_studio/index.html index b8b1166..6bdcfb9 100644 --- a/es/tutorials/android_studio/index.html +++ b/es/tutorials/android_studio/index.html @@ -62,22 +62,25 @@
Todo el código que define la API de Processing está incluido dentro de archivo processing-core.zip, que está dentro de la subcarpeta AndroidMode en la carpeta de modos dentro de la carpeta de bosquejos. Lo único que tienes que hacer es copiar este archivo como rocessing-core.jar y agregarlo como una dependencia a tu proyecto. El procedimiento paso a paso para hacer esto con Android Studio se detalla a continuación:
-1.Crea un proyecto Android si es que todavía no tienes uno:
-1.Cree un proyecto de Android si aún no lo ha creado. Comience seleccionando una actividad vacía:
+2.Selecciona el dispositivo de objetivo:
-2.Ingrese el nombre del proyecto, el nombre del paquete y la versión mínima del SDK. Mantenga la opción 'Use legacy android.support libraries' sin marcar, ya que el último núcleo de procesamiento de Android se migra a androidx. Después de eso, haga clic en el botón 'Finish':
+3.Agrega una activiadad vacía:
-3. Copia processing-core.zip (ubicado en la carpeta AndroidMode en Processing) a app/libs, renómbralo como processing-core.jar y agrégalo como una dependencia jar a el proyecto:
+4. Ingresar el nombre para la clase de actividad principal y el archivo de diseño (layout):
-4. Para agregarlo como una dependencia de jar, haga clic en Archivo -> Estructura del proyecto. Un cuadro de diálogo aparecerá:
+5. Copia processing-core.zip (ubicado en la carpeta AndroidMode en Processing) a app/libs, renómbralo como processing-core.jar y agrégalo como una dependencia jar a el proyecto:
-5. Seleccione 'dependencies' en el panel más a la izquierda y luego haga clic en 'app' en el panel de módulos. Haga clic en el botón más bajo Declared Dependencies y luego haga clic en Jar Dependency. Aparecerá otro cuadro de diálogo:
+6. Una vez hecho todo lo anterior, escribe el código de tu bosquejo extendiendo la clase PApplet, por ejemplo:
+6. En el cuadro de diálogo Agregar jar, ingrese la ruta como 'libs / processing-core.jar' y en el Paso 2, ingrese el alcance como 'implementación'. Haga clic en 'OK', 'Apply' y luego nuevamente en 'OK':
+7. Una vez hecho todo lo anterior, escribe el código de tu bosquejo extendiendo la clase PApplet, por ejemplo:
// Sketch.java
@@ -100,58 +103,58 @@ Pasos generales
}
- 7. Inicializa el bosquejo en la actividad principal:
+8. Inicializa el bosquejo en la actividad principal:
package tutorials.androidstudio.fragmentsv4;
-import android.os.Bundle;
+import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
+import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.FrameLayout;
-import android.support.v7.app.AppCompatActivity;
-
import processing.android.PFragment;
import processing.android.CompatUtils;
import processing.core.PApplet;
public class MainActivity extends AppCompatActivity {
- private PApplet sketch;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- FrameLayout frame = new FrameLayout(this);
- frame.setId(CompatUtils.getUniqueViewId());
- setContentView(frame, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT));
-
- sketch = new Sketch();
- PFragment fragment = new PFragment(sketch);
- fragment.setView(frame, this);
- }
+ private PApplet sketch;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ FrameLayout frame = new FrameLayout(this);
+ frame.setId(CompatUtils.getUniqueViewId());
+ setContentView(frame, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT));
+
+ sketch = new Sketch();
+ PFragment fragment = new PFragment(sketch);
+ fragment.setView(frame, this);
+ }
- @Override
- public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
- if (sketch != null) {
- sketch.onRequestPermissionsResult(
- requestCode, permissions, grantResults);
+ @Override
+ public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
+ if (sketch != null) {
+ sketch.onRequestPermissionsResult(
+ requestCode, permissions, grantResults);
+ }
}
- }
- @Override
- public void onNewIntent(Intent intent) {
- if (sketch != null) {
- sketch.onNewIntent(intent);
+ @Override
+ public void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+ if (sketch != null) {
+ sketch.onNewIntent(intent);
+ }
}
- }
}
- 8. Finalmente, crea un diseño (layout) mínimo para la actividad principal:
+9. Finalmente, crea un diseño (layout) mínimo para la actividad principal:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
diff --git a/imgs/tutorials/android_studio/1_new_project.png b/imgs/tutorials/android_studio/1_new_project.png
deleted file mode 100644
index 28e30bf..0000000
Binary files a/imgs/tutorials/android_studio/1_new_project.png and /dev/null differ
diff --git a/imgs/tutorials/android_studio/1selectActivity.png b/imgs/tutorials/android_studio/1selectActivity.png
new file mode 100644
index 0000000..ca98e22
Binary files /dev/null and b/imgs/tutorials/android_studio/1selectActivity.png differ
diff --git a/imgs/tutorials/android_studio/2_target.png b/imgs/tutorials/android_studio/2_target.png
deleted file mode 100644
index 5352ac1..0000000
Binary files a/imgs/tutorials/android_studio/2_target.png and /dev/null differ
diff --git a/imgs/tutorials/android_studio/2projectName.png b/imgs/tutorials/android_studio/2projectName.png
new file mode 100644
index 0000000..03bead7
Binary files /dev/null and b/imgs/tutorials/android_studio/2projectName.png differ
diff --git a/imgs/tutorials/android_studio/3_add_activity.png b/imgs/tutorials/android_studio/3_add_activity.png
deleted file mode 100644
index ee98f55..0000000
Binary files a/imgs/tutorials/android_studio/3_add_activity.png and /dev/null differ
diff --git a/imgs/tutorials/android_studio/3copyzip.png b/imgs/tutorials/android_studio/3copyzip.png
new file mode 100644
index 0000000..862898f
Binary files /dev/null and b/imgs/tutorials/android_studio/3copyzip.png differ
diff --git a/imgs/tutorials/android_studio/4ClickFile.png b/imgs/tutorials/android_studio/4ClickFile.png
new file mode 100644
index 0000000..20ffc59
Binary files /dev/null and b/imgs/tutorials/android_studio/4ClickFile.png differ
diff --git a/imgs/tutorials/android_studio/4_customize_activity.png b/imgs/tutorials/android_studio/4_customize_activity.png
deleted file mode 100644
index 5f0ce3c..0000000
Binary files a/imgs/tutorials/android_studio/4_customize_activity.png and /dev/null differ
diff --git a/imgs/tutorials/android_studio/5Addjar.png b/imgs/tutorials/android_studio/5Addjar.png
new file mode 100644
index 0000000..8360c20
Binary files /dev/null and b/imgs/tutorials/android_studio/5Addjar.png differ
diff --git a/imgs/tutorials/android_studio/5_module_settings.png b/imgs/tutorials/android_studio/5_module_settings.png
deleted file mode 100644
index 70f8db5..0000000
Binary files a/imgs/tutorials/android_studio/5_module_settings.png and /dev/null differ
diff --git a/imgs/tutorials/android_studio/6addjardialog.png b/imgs/tutorials/android_studio/6addjardialog.png
new file mode 100644
index 0000000..a1c7b8e
Binary files /dev/null and b/imgs/tutorials/android_studio/6addjardialog.png differ
diff --git a/tutorials/android_studio/index.html b/tutorials/android_studio/index.html
index 4f9e7b3..67367c2 100644
--- a/tutorials/android_studio/index.html
+++ b/tutorials/android_studio/index.html
@@ -1,85 +1,88 @@
-
-
-
-
-
-
- Processing for Android
-
-
-
-
-
-
-
- Processing for Android
-
-
-
-
-
-
-
-
-
-
-
- Developing with Android Studio
- Use Android Studio for advanced Android development with Processing's core library.
-
- General steps
-
-
- Android Studio is the tool recommended by Google for Android development. If you've already have experience on how to develop Android applications using Android Studio (separately from Processing), and want to make use of the Processing core library in your Android Studio projects, this tutorial can be useful.
-
-
- All our core code is bundled inside the processing-core.zip, which is inside the AndroidMode folder. You just need to copy this file as processing-core.jar and add it as a dependency to your project. Step by step procedure for Android Studio is as follows:
-
- 1. Create an Android project if you haven't already created one:
- 
-
- 2. Select the target device:
- 
-
- 3. Add an empty activity:
- 
-
- 4. Set the name for the main activity class and the layout file:
- 
-
- 5. Copy processing-core.zip (located in the AndroidMode folder in Processing) to /app/libs, rename it to processing-core.jar, and add it as a jar dependency to the project:
- 
-
- 6. Then, write your sketch code by extending PApplet, for example:
-
-
+
+
+
+
+
+
+ Processing for Android
+
+
+
+
+
+
+
+ Processing for Android
+
+
+
+
+
+
+
+
+
+
+
+ Developing with Android Studio
+ Use Android Studio for advanced Android development with Processing's core library.
+
+ General steps
+
+
+ Android Studio is the tool recommended by Google for Android development. If you've already have experience on how to develop Android applications using Android Studio (separately from Processing), and want to make use of the Processing core library in your Android Studio projects, this tutorial can be useful.
+
+
+ All our core code is bundled inside the processing-core.zip, which is inside the AndroidMode folder. You just need to copy this file as processing-core.jar and add it as a dependency to your project. Step by step procedure for Android Studio is as follows:
+
+ 1. Create an Android project if you haven't already created one. Start with selecting an Empty Activity:
+ 
+
+ 2. Enter project name, package name and minimum SDK version. Keep the 'Use legacy android.support libraries' option unchecked as the latest android processing core is migrated to androidx. After that click on 'Finish' button:
+ 
+
+ 3. Copy processing-core.zip (located in the AndroidMode folder in Processing) to /app/libs, rename it to processing-core.jar:
+ 
+
+ 4. To add it as a jar dependency, Click on File -> Project Structure. A dialog box will appear:
+ 
+
+ 5. Select 'dependencies' in the left most panel and then click on 'app' in modules panel. Click on plus button under Declared Dependencies and then click on Jar Dependency. Another dialog box will appear:
+ 
+
+ 6. In the add jar dialog enter path as 'libs/processing-core.jar' and in Step 2, enter scope as 'implementation'. Click on 'OK', 'Apply' and then again 'OK':
+ 
+
+ 7. Then, write your sketch code by extending PApplet, for example:
+
+
// Sketch.java
package tutorials.androidstudio.fragmentsv4;
@@ -100,62 +103,62 @@ General steps
}
- 7. Initialize the sketch in the main activity:
+ 8. Initialize the sketch in the main activity:
-
+
package tutorials.androidstudio.fragmentsv4;
-import android.os.Bundle;
+import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
+import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.FrameLayout;
-import android.support.v7.app.AppCompatActivity;
-
import processing.android.PFragment;
import processing.android.CompatUtils;
import processing.core.PApplet;
public class MainActivity extends AppCompatActivity {
- private PApplet sketch;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- FrameLayout frame = new FrameLayout(this);
- frame.setId(CompatUtils.getUniqueViewId());
- setContentView(frame, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
- ViewGroup.LayoutParams.MATCH_PARENT));
-
- sketch = new Sketch();
- PFragment fragment = new PFragment(sketch);
- fragment.setView(frame, this);
- }
+ private PApplet sketch;
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ FrameLayout frame = new FrameLayout(this);
+ frame.setId(CompatUtils.getUniqueViewId());
+ setContentView(frame, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
+ ViewGroup.LayoutParams.MATCH_PARENT));
+
+ sketch = new Sketch();
+ PFragment fragment = new PFragment(sketch);
+ fragment.setView(frame, this);
+ }
- @Override
- public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
- if (sketch != null) {
- sketch.onRequestPermissionsResult(
- requestCode, permissions, grantResults);
+ @Override
+ public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
+ if (sketch != null) {
+ sketch.onRequestPermissionsResult(
+ requestCode, permissions, grantResults);
+ }
}
- }
- @Override
- public void onNewIntent(Intent intent) {
- if (sketch != null) {
- sketch.onNewIntent(intent);
+ @Override
+ public void onNewIntent(Intent intent) {
+ super.onNewIntent(intent);
+ if (sketch != null) {
+ sketch.onNewIntent(intent);
+ }
}
- }
}
-
+
- 8. Finally, create a simple layout for the main activity:
+ 9. Finally, create a simple layout for the main activity:
-
+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
@@ -167,30 +170,30 @@ General steps
android:layout_width="match_parent"
android:layout_height="match_parent" />
-</RelativeLayout>
+</RelativeLayout>
- The complete Android Studio project is available here.
+ The complete Android Studio project is available here.
- Using Bintray packages
+ Using Bintray packages
-
- The processing-core library is also available as a package on Bintray. This package can be easily imported into a Gradle project using the following dependency snippet:
+
+ The processing-core library is also available as a package on Bintray. This package can be easily imported into a Gradle project using the following dependency snippet:
-
+
compile 'org.p5android:processing-core:x.y.z'
- where x.y.z is the desired version to use. In Android Studio, the processing-core package will appear as a module dependency as follows:
- 
+ where x.y.z is the desired version to use. In Android Studio, the processing-core package will appear as a module dependency as follows:
+ 
-
+
-
+
-
-
+
+