First of all:
ALL of the answers of the related questions did not solved my problem, thats why i am creating a new question.
Explanation:
I have a huge android app, i use Eclipse-ADT plugin and i am using a smartphone that have android 4.0.4 to do the tests, i have a lot of Activity's and i pass values between Activity's via Bundle getExtras in onCreate() and too i get some values on onActivityResult's.
Obs:
(1) = Activity A that calls for result -> Activity B
(2) = Activity B that get values from Activity A and returns other values to -> Activity A.
Problem:
I have ProdutosForm.java(1) activity and PedidoItemx.java(2) activity.
Inside ProdutosForm.java(1), i am starting PedidoItemx.java(2) activity to get a result:
Code for item 2:
<!-- language: lang-java -->
Intent i = new Intent();
i.setClass(this, PedidoItemx.class);
i.putExtra("CODE", code );
...
... (a LOT of putExtras....)
...
//and after putExtras, thats the relevant part
startActivityForResult(i, 1); //i its the Intent setted as PedidoItemx.class
Inside PedidoItemx.java(2) onCreate method i have:
Code for item 3:
<!-- language: lang-java -->
Bundle extras = getIntent().getExtras();
code = extras.getString("CODE");
4. Too, still inside PedidoItemx.java(2) i set some new values and i set the result to RESULT_OK:
Code for item 4
<!-- language: lang-java -->
Intent i = getIntent();
i.putExtra("PEDIDO", cPedPedido);
i.putExtra("VLRFRETE", valorFrete);
setResult(RESULT_OK, i); //RESULT_OK is a native constant that have value -1
finish();
Now, returning to ProdutosForm.java(1) i have the following onActivityResult code to get the values returned by PedidoItemx.java(2):
Code for item 5:
<!-- language: lang-java -->
public void onActivityResult(int requestCode,int resultCode,Intent data){
if(resultCode==RESULT_OK && requestCode==1){
Bundle MBuddle = data.getExtras();
Intent i = getIntent();
String cPedidoExtra = MBuddle.getString("PEDIDO");
i.putExtra("PEDIDO", cPedidoExtra);
i.putExtra("VLRFRETE", MBuddle.getFloat("VLRFRETE", 0));
cPedPedido = cPedidoExtra; //this does nothing important
setResult(RESULT_OK, i);
}
}
Everything looks OK and should work, but it doesn't. BECAUSE my requestCode is always 0 and my data is always null thats the real problem.
My manifest:
<!-- language: lang-xml -->
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="bee.mobile"
android:versionCode="2"
android:versionName="1.50" >
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="7" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_CHECKIN_PROPERTIES" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
<uses-permission android:name="android.permission.ACCOUNT_MANAGER" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<!-- <uses-permission android:name="android.permission.RECEIVE_SMS" /> -->
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:screenOrientation="user"
android:debuggable="true"> <!-- mudar para false ao gerar depois -->
<activity
android:name="bee.mobile.form.outros.SplashActivity"
android:label="#string/app_name"
android:screenOrientation="sensor">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Outros -->
<activity android:name="bee.mobile.form.outros.MainActivity"/>
<activity android:name="bee.mobile.form.outros.HistoricoClienteForm"/>
<activity android:name="bee.mobile.form.outros.HistoricoListaNotasForm"/>
<activity android:name="bee.mobile.form.outros.HistoricoNotaForm"/>
<activity android:name="bee.mobile.form.outros.HistoricoProdutoForm"/>
<activity android:name="bee.mobile.form.outros.HistoricoMesProdForm"/>
<activity android:name="bee.mobile.form.outros.HistoricoQuemForm"/>
<activity android:name="bee.mobile.form.outros.PedidoItemx"/>
<activity android:name="bee.mobile.form.outros.RelatoriosForm"/>
<activity android:name="bee.mobile.form.outros.EstufaDetalhes"
android:windowSoftInputMode="stateHidden"/>
<!-- Lista -->
<activity android:name="bee.mobile.form.lista.ClientesForm"/>
<activity android:name="bee.mobile.form.lista.ProdutosForm"/>
<activity android:name="bee.mobile.form.lista.PedidoListaForm"/>
<activity android:name="bee.mobile.form.lista.ContatosListaForm"/>
<activity android:name="bee.mobile.form.lista.GruposForm"/>
<activity android:name="bee.mobile.form.lista.NotaListaForm"/>
<!-- Cadastro -->
<activity android:name="bee.mobile.form.cadastro.PedidoCadForm"/>
<activity android:name="bee.mobile.form.cadastro.ClientesCadastroForm"
android:windowSoftInputMode="stateHidden"/>
<activity android:name="bee.mobile.form.cadastro.ContatosCadForm"
android:windowSoftInputMode="stateHidden"/>
<activity android:name="bee.mobile.form.cadastro.PedidoCadForm_Financeiro"/>
<!-- Sem destino -->
<activity android:name="bee.mobile.ConfigurarForm"/>
<activity android:name="bee.mobile.ConfiguracaoLocalForm"/>
<activity android:name="bee.mobile.AtualizaManual"/>
<activity android:name="bee.mobile.ReceberForm"/>
<activity android:name="bee.mobile.ResolucaoForm"/>
<activity android:name="bee.mobile.AtualizarForm"/>
<activity android:name="bee.mobile.ParticipantesVendaForm"/>
</application>
</manifest>
Question:
Why i cant get the data returned from Activity B?? i am doing something wrong?
I figured out the solution for my problem:
I dont know WHY but if i MOVE this piece of code that is actually on buttonClick event on Activity B(2):
Intent i = getIntent();
i.putExtra("PEDIDO", cPedPedido);
i.putExtra("VLRFRETE", valorFrete);
setResult(RESULT_OK, i); //RESULT_OK is a native constant that have value -1
finish();
To -> right after onCreate, it works ok.
But if i move back this code "to the right place" on a button click, it doesnt work, i really dont know why the activity is having this very weird behaviour, but i'll be happy to share when i figure it out.
In other words, i have to set the extras and the RESULT_OK before doing anything, otherwise it didnt work.
I think you should add an action ACTION_SEND to your intent to return to the other activity. Something like this:
Intent i = getIntent();
**i.setAction(Intent.ACTION_SEND);**
i.putExtra("PEDIDO", cPedPedido);
i.putExtra("VLRFRETE", valorFrete);
setResult(RESULT_OK, i);
finish();
Use:
Intent i = this.getIntent();
instead of
Intent i = getIntent();
in the activity where you need to receive data of the intent, which has the values binded to some keys.
Related
Sadly, Android 11 storage restrictions are too hard and confusing.
I'm trying to pick a document using the below code
fun onFile(activity: AppCompatActivity?, fragmentContext: Fragment?, isMultiple: Boolean?, pFileMimeTypes: Array<String>?): Intent {
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT).apply {
action = Intent.ACTION_OPEN_DOCUMENT
addCategory(Intent.CATEGORY_OPENABLE)
putExtra(Intent.EXTRA_ALLOW_MULTIPLE, isMultiple ?: false)
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION)
}
val fileMimeTypes = pFileMimeTypes ?: FileUtil.mimeTypes
intent.type = if (fileMimeTypes.size == 1) fileMimeTypes[0] else "*/*"
if (!fileMimeTypes.isNullOrEmpty()) {
intent.putExtra(Intent.EXTRA_MIME_TYPES, fileMimeTypes)
}
val list = activity?.packageManager?.queryIntentActivities(intent, PackageManager.MATCH_ALL)
if (list?.size!! > 0) {
if (fragmentContext == null) {
activity.startActivityForResult(
Intent.createChooser(
intent,
activity.getString(R.string.m_selectFile_txt)
), FILE_CODE
)
} else {
fragmentContext.startActivityForResult(
Intent.createChooser(
intent,
activity.getString(R.string.m_selectFile_txt)
), FILE_CODE
)
}
}
// returning intent is not being used anywhere else
return intent
}
Although I have all files access permission Environment.isExternalStorageManager() but still after selecting document(PDF) from the external storage (download or any folder), OnActvityResult is being called with result code 0. I need the Uri of the selected document to proceed further.
For any other reference, below is my manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="*****Hidden*******">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
tools:ignore="ScopedStorage" />
<uses-permission android:name="android.permission.READ_STORAGE_PERMISSION"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.CAMERA" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:requestLegacyExternalStorage="true"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
<activity
android:exported="true"
android:name=".Main2Activity"
android:launchMode="singleTask"
android:label="#string/title_activity_main2"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:theme="#style/AppTheme.NoActionBar">
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.attachmentmanager"
android:exported="false"
android:grantUriPermissions="true"
tools:replace="android:authorities">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="#xml/file_provider"
tools:replace="android:resource" />
</provider>
</application>
<queries>
<intent>
<action android:name="android.intent.action.OPEN_DOCUMENT" />
<!-- If you don't know the MIME type in advance, set "mimeType" to "*/*". -->
<data android:mimeType="*/*" />
</intent>
<intent>
<action android:name="android.intent.action.PICK" />
<!-- If you don't know the MIME type in advance, set "mimeType" to "*/*". -->
<data android:mimeType="*/*" />
</intent>
</queries>
</manifest>
I must be missing some point. Everything is working fine below Android 11
Thanks in Advance.
startActivityForResult is deprecated
Refer this link
Use Activity Results API
Official Docs
I have a program with a service and if I reboot my device also the service should Restart. But this only works on the Emulator if I try this on my real device the service doesn't start at all.
Does someone know what I'm doing wrong or why it only works on Emulator?
BroadcastReviever:
#Override
public void onReceive(Context context, Intent intent) {
//we double check here for only boot complete event
if(intent.getAction().equalsIgnoreCase(Intent.ACTION_BOOT_COMPLETED))
{
//here we start the service
Intent serviceIntent = new Intent(context, UploadService.class);
context.startService(serviceIntent);
}
}
Manifest.xml:
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.GET_ACCOUNTS_PRIVILEGED"
tools:ignore="ProtectedPermissions" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.READ_OWNER_DATA" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
<uses-permission android:name="android.permission.READ_OWNER_DATA" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="Upload FTP"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<receiver
android:name=".BootCompletedIntentReceiver"
android:enabled="true"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter >
</activity>
<service
android:name=".UploadService"
android:isolatedProcess="false"
android:exported="true"
android:enabled="true"/>
</application>
The emulator is at API 23 and real device is API 27.
I'm Building for a min API Level 23 and max API Level 27
EDIT
Now I have also tried the program with a emulator and android API 27 and there when I start my program and then I restart the emulator, the emulator doesn't start any more. As soon as the emulaor has started he begins to reboot again and that in a endless loop. (Real device starts normal just doesn't restarts service)
try to use LOCKED_BOOT_COMPLETED receiver as follow:
<receiver
android:name=".BootReceiver"
android:directBootAware="true"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED"/>
<!-- For pre-N devices -->
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
don't forget permission
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
take a look here for more explanation
Now I fixed in on my own it was easier then i thought
public class BootCompletedIntentReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
Intent i=new Intent(context, YourClass.class);
if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.O) {
context.startForegroundService(i);
}
else {
context.startService(i);
}
}
I had some weird experience if I don't put full URI,
for example .BootCompletedIntentReceiver would become com.company.BootCompletedIntentRecevier.
I know it sounds dumb but I had many weird regressions when not explicitly stating things on the Manifest with modern SDKs.
I am attempting to migrate an app from Parse to OneSignal. Things have been running fairly smooth except for one issue. If the app has not already been started, clicking (opening) the notification does not launch the app and bring it to the foreground.
I am using a custom onNotificationOpenedHandler:
Main Activity, onCreate
// Init OneSignal
OneSignal.startInit(this).setNotificationOpenedHandler(new NotificationOpenHandler()).init();
NotificationOpenedHandler, also in the launcher Main Activity:
class NotificationOpenHandler implements OneSignal.NotificationOpenedHandler {
// This fires when a notification is opened by tapping on it.
#Override
public void notificationOpened(OSNotificationOpenResult result) {
JSONObject data = result.notification.payload.additionalData;
String stationName = data.optString("stationName");
String timestamp = data.optString("timestamp");
String filename = data.optString("filename");
String url = getString(R.string.callResourceUrl) + filename;
Log.d("APP", "Notification clicked");
Intent intent = new Intent(getApplicationContext(), CallActivity.class);
intent.putExtra("stationName", stationName);
intent.putExtra("time", timestamp);
intent.putExtra("url", url);
intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
}
Here is my Android Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.opheliadesign.tevfd">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:supportsRtl="true"
android:allowBackup="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:logo="#drawable/ic_launcher"
android:launchMode="singleInstance"
android:theme="#style/Theme.Tevfd">
<activity android:name="com.example.app.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".CallActivity"
android:label="#string/title_activity_call"
android:parentActivityName=".MainActivity"
android:screenOrientation="portrait" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.example.app.MainActivity" />
</activity>
<meta-data android:name="com.onesignal.NotificationOpened.DEFAULT" android:value="DISABLE" />
</application>
</manifest>
Any ideas?
UPDATE
Previously, using Parse, I utilized a BroadcastReceiver with a PendingIntent. It seems a bit unclear how to accomplish this with OneSignal as so much seems to be configured automatically.
If I remove the custom Intent, the application comes to the foreground.
Any help would be greatly appreciated.
my application crashes at start and I have no idea why. I'm testing it on a real device (Samsung Galaxy S3 GT-I9300). Here is the exception:
EDIT:
So, that's what I've added to onCreate():
walking.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
travel_mode = "walking";
walking.setImageResource(R.drawable.walking_sel);
biking.setImageResource(R.drawable.regular_biking);
driving.setImageResource(R.drawable.car_icon);
transit.setImageResource(R.drawable.transit_icon);
}
});
biking.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
travel_mode = "biking";
walking.setImageResource(R.drawable.walking);
biking.setImageResource(R.drawable.regular_biking_sel);
driving.setImageResource(R.drawable.car_icon);
transit.setImageResource(R.drawable.transit_icon);
}
});
Before I've added this piece of code, everything worked correctly.
And here is AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="lukssoftware.kaart" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-library android:name="com.google.android.maps" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="***" />
<meta-data android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
<activity
android:name="lukssoftware.kaart.kaart_welcome"
android:screenOrientation="portrait"
android:label="kaart" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Any ideas?
Thanks.
Please post more code and there is nothing to do with manifest here post layout xml and activity code where you have defined walking and biking findViews().
Just check it out that you have defined findViewsById of both walking and biking before you are calling setOnClickListener method.
Does your application still compile successfully after deleting the two modules?
If it doesn't compile, look for the lines in your classes or xml files which have yellow or red exclamation marks. That should alert you to where the problem is coming from.
You should also take a good look at line 64 in your *welcome.java class.
With the code below, I can open applications such as: Google Maps, calculator and
retain their state when they pass to foreground:
Intent i;
PackageManager manager = getPackageManager();
try {
i = manager.getLaunchIntentForPackage("com.google.android.apps.maps");
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (i == null)
throw new PackageManager.NameNotFoundException();
i.setAction("android.intent.action.VIEW");
startActivity(i);
} catch (PackageManager.NameNotFoundException e) {
}
My problem is with an application created by me, because my application does not maintain the state. She is always restarted.
I have tried to use the properties in the manifest: launchMode, alwaysRetainTaskState, always unsuccessful.
Thanks in Advance
The android activity has different stages like Pause and resume which is called when an activity is paused. If the foreground activities stopped , the app may even visible in an paused state. In such cases you need to override your onPause() methods to say to your activity what to do if it paused.
Add the logic you need to perform when your activity paused in the onPause() method.
#Override
public void onPause() {
super.onPause(); // Always call the superclass method first
do some task here...
if (connectServer) {
pauseDownloadData();
}
}
when you resume your activity, it will invoke onResume()
public void onResume() {
super.onResume(); // Always call the superclass method first
do some task here...
if (connectServer) {
resumeDownloadData(); // Local method to handle camera init
}
}
Problem solved, with the solution below. Now I can start my application, if it is closed or resume (resume in any activity).
The code that starts the application is (Launcher):
Intent i;
PackageManager manager = getPackageManager();
try
{
i.addFlags(0);
i.setPackage(null);
if (i == null)
throw new PackageManager.NameNotFoundException();
startActivity(i);
}
catch (PackageManager.NameNotFoundException e)
{
}
My application that starts, has the following manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="14" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.WRITE_CONTACTS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:label="#string/app_name"
android:name=".Main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Screen2"
android:label="#string/screen2Title"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleTask" >
</activity>
<activity android:name=".Screen3"
android:label="#string/screen3Title"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleTask" >
</activity>
</application>
</manifest>
Now the application is resumed to any activity, without ever navigate to the root activity.