Skip to content

Commit

Permalink
android multi activity example: add manifest (#6036)
Browse files Browse the repository at this point in the history
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
arturoc committed Aug 1, 2018
1 parent a0c412a commit 31ca506
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 4 deletions.
4 changes: 1 addition & 3 deletions examples/android/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
**/.gitignore
**/AndroidManifest.xml
**/res/
**/*.gradle
**/srcJava
**/*.gradle
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>
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");
}
}

0 comments on commit 31ca506

Please sign in to comment.