The application delphi calls a java application activity and in the call it presents the following error:
android.content.ActivityNotFoundException: Unable to find explicity activity class {com.embarcadero.pedro.mostraparametrob / actMostraParametros}; have you declared this activity in your AndroidManiftst.xml
but the Android Studio debug shows the two applications running.
follow the listings
delphi application:
var Intent : JIntent;
componente : JComponentName;
apk,classe : JString;
begin
apk := stringtoJstring('com.embarcadero.pedro.mostraparametrob');
classe := stringtoJstring('actMostraParametros');
componente := TJComponentName.JavaClass.init(apk,classe);
Intent := TJIntent.Create;
Intent.setAction(apk);
Intent.setComponent(componente);
try
SharedActivity.startActivity(Intent);
except on E: Exception do
ShowMessage(E.Message);
end;
end;
the manifest.xml of the activity provider app
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.embarcadero.pedro.mostraparametrob" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".actMain"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".actMostraParametros"
android:label="actMostraParametros" >
</activity>
</application>
</manifest>
the activity called
package com.embarcadero.pedro.mostraparametrob;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.*;
import android.view.*;
public class actMostraParametros extends ActionBarActivity implements View.OnClickListener {
private TextView edtValor1, edtValor2;
private Button btnVoltar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.act_mostra_parametros);
edtValor1 = (TextView)findViewById(R.id.edtValor1);
edtValor2 = (TextView)findViewById(R.id.edtValor2);
btnVoltar = (Button)findViewById(R.id.btnVoltar);
btnVoltar.setOnClickListener(this);
Bundle bdl = getIntent().getExtras();
if (bdl.containsKey("para1"))
{
String valor1 = bdl.getString("para1");
edtValor1.setText(valor1);
}
if (bdl.containsKey("para2"))
{
String valor2 = bdl.getString("para2");
edtValor2.setText(valor2);
}
}
public void onClick(View v)
{
finish();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_act_mostra_parametros, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}