You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<p>Use Android Studio for advanced Android development with Processing's core library.</p>
56
-
57
-
<h3>General steps</h3>
58
-
59
-
<p>
60
-
<ahref="https://developer.android.com/studio/index.html" target="_black">Android Studio</a> 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.</p>
61
-
62
-
<p>
63
-
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:</p>
64
-
65
-
<p><b>1.</b> Create an Android project if you haven't already created one:</p>
<p><b>5.</b> 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:</p>
<p>Use Android Studio for advanced Android development with Processing's core library.</p>
56
+
57
+
<h3>General steps</h3>
58
+
59
+
<p>
60
+
<ahref="https://developer.android.com/studio/index.html" target="_black">Android Studio</a> 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.</p>
61
+
62
+
<p>
63
+
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:</p>
64
+
65
+
<p><b>1.</b> Create an Android project if you haven't already created one. Start with selecting an Empty Activity:</p>
<p><b>2.</b> 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:</p>
<p><b>5.</b> 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:</p>
<p><b>6.</b> 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':</p>
setContentView(frame, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
129
+
ViewGroup.LayoutParams.MATCH_PARENT));
130
+
131
+
sketch = new Sketch();
132
+
PFragment fragment = new PFragment(sketch);
133
+
fragment.setView(frame, this);
134
+
}
133
135
134
-
@Override
135
-
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
136
-
if (sketch != null) {
137
-
sketch.onRequestPermissionsResult(
138
-
requestCode, permissions, grantResults);
136
+
@Override
137
+
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
138
+
if (sketch != null) {
139
+
sketch.onRequestPermissionsResult(
140
+
requestCode, permissions, grantResults);
141
+
}
139
142
}
140
-
}
141
143
142
-
@Override
143
-
public void onNewIntent(Intent intent) {
144
-
if (sketch != null) {
145
-
sketch.onNewIntent(intent);
144
+
@Override
145
+
public void onNewIntent(Intent intent) {
146
+
super.onNewIntent(intent);
147
+
if (sketch != null) {
148
+
sketch.onNewIntent(intent);
149
+
}
146
150
}
147
-
}
148
151
}
149
152
</code></pre>
150
153
151
154
152
-
<divclass="butterbar">
153
-
The <code>onRequestPermissionsResult()</code> method in the main activity is needed in the case the app uses any <ahref="https://developer.android.com/guide/topics/permissions/requesting.html#normal-dangerous">dangerous permissions</a>. If missing, the results of requesting the permission to the user will not reach the sketch, and it may fail to work properly. onNewIntent() is also needed so the sketch can handle intents sent to the main activity.</div>
155
+
<divclass="butterbar">
156
+
The <code>onRequestPermissionsResult()</code> method in the main activity is needed in the case the app uses any <ahref="https://developer.android.com/guide/topics/permissions/requesting.html#normal-dangerous">dangerous permissions</a>. If missing, the results of requesting the permission to the user will not reach the sketch, and it may fail to work properly. onNewIntent() is also needed so the sketch can handle intents sent to the main activity.</div>
154
157
155
158
156
-
<p><b>8.</b> Finally, create a simple layout for the main activity:</p>
159
+
<p><b>9.</b> Finally, create a simple layout for the main activity:</p>
<p>The complete Android Studio project is available <ahref="https://github.com/codeanticode/processing-android-tutorials/tree/master/android_studio/ex2_fragmentsv4" target="_black">here</a>.</p>
176
+
<p>The complete Android Studio project is available <ahref="https://github.com/codeanticode/processing-android-tutorials/tree/master/android_studio/ex2_fragmentsv4" target="_black">here</a>.</p>
174
177
175
-
<h3>Using Bintray packages</h3>
178
+
<h3>Using Bintray packages</h3>
176
179
177
-
<p>
178
-
The processing-core library is also available as a package on <ahref="https://bintray.com/p5android/processing-android/processing-core" target="_black">Bintray</a>. This package can be easily imported into a Gradle project using the following dependency snippet:</p>
180
+
<p>
181
+
The processing-core library is also available as a package on <ahref="https://bintray.com/p5android/processing-android/processing-core" target="_black">Bintray</a>. This package can be easily imported into a Gradle project using the following dependency snippet:</p>
179
182
180
-
<pre><code>
183
+
<pre><code>
181
184
compile 'org.p5android:processing-core:x.y.z'
182
185
</code></pre>
183
186
184
-
<p>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:</p>
0 commit comments