-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
android multi activity example: add manifest (#6036)
This example needs a custom manifest, the one created by the PG doeswn't contain the second activity. Also git unignore manifest and srcJava Fixes #6036
- Loading branch information
Showing
3 changed files
with
67 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
**/.gitignore | ||
**/AndroidManifest.xml | ||
**/res/ | ||
**/*.gradle | ||
**/srcJava | ||
**/*.gradle |
38 changes: 38 additions & 0 deletions
38
examples/android/androidMultiOFActivitiesExample/AndroidManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="cc.openframeworks.androidMultiOFActivitiesExample" | ||
android:installLocation="preferExternal"> | ||
|
||
<!-- Add custom permissions here, for example --> | ||
<!--<uses-permission android:name="android.permission.CAMERA"/>--> | ||
<!--<uses-permission android:name="android.permission.INTERNET"/>--> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@drawable/ic_launcher" | ||
android:label="@string/app_name" | ||
android:theme="@style/AppTheme" | ||
> | ||
|
||
<!-- If you want to use a custom android activity, then change the name here --> | ||
<activity | ||
android:name="cc.openframeworks.androidMultiOFActivitiesExample.OFActivityA" | ||
android:label="@string/app_name" android:configChanges="orientation|screenSize"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<!-- If you want to use a custom android activity, then change the name here --> | ||
<activity | ||
android:name="cc.openframeworks.androidMultiOFActivitiesExample.OFActivityB" | ||
android:label="@string/app_name" android:configChanges="orientation|screenSize"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
29 changes: 28 additions & 1 deletion
29
...ivitiesExample/srcJava/cc/openframeworks/androidMultiOFActivitiesExample/OFActivityB.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,32 @@ | ||
package cc.openframeworks.androidMultiOFActivitiesExample; | ||
|
||
import android.content.Intent; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.RelativeLayout; | ||
|
||
public class OFActivityB extends cc.openframeworks.OFActivity{ | ||
|
||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) | ||
{ | ||
super.onCreate(savedInstanceState); | ||
Button btn = new Button(this); | ||
btn.setText("Go To Activity A"); | ||
btn.setOnClickListener(new View.OnClickListener() { | ||
|
||
@Override | ||
public void onClick(View v) { | ||
startActivity(new Intent(OFActivityB.this, OFActivityA.class)); | ||
} | ||
}); | ||
RelativeLayout rootView = (RelativeLayout)findViewById(R.id.relativeLayout1); | ||
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); | ||
params.addRule(RelativeLayout.CENTER_HORIZONTAL); | ||
params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); | ||
rootView.addView(btn, params); | ||
Log.d("OFActivityB", "onCreate"); | ||
} | ||
} |