У меня есть приложение, которое выходит на экран homeScreen, когда я нажимаю кнопку «Назад» в определенной активности с помощью Galaxy SII (Android 4.0.4), но она возвращается нормально ко всем предыдущим действиям, которые не вызывают метод finish() при использовании HTC EVO (Android 2.3.5).Приложение закрывается, когда кнопка возврата на телефоне отсутствует, но нет в другом
Я думал, что это была функция Android-версии, и теперь я более уверен в ее безопасности. Я попытался использовать эмулятор в этой версии, и результат был таким же. Это проблема с версией Android.
Здесь я прикрепляю изображения, так что может быть ясно, в чем проблема.
Если я нажимаю кнопку назад на этой позиции, он берет меня из приложения на главном экране. То есть с галактикой S3
Но с android 2.3.5, вот как это работает.
В версии 2.3.5, я нажимаю назад, каждое действие возвращается на передний план. Любые подсказки об этой проблеме?
Код манифеста:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.silm.sfa"
android:versionCode="2"
android:versionName="1.1" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:name="com.silm.sfa.app.App"
android:allowBackup="true"
android:icon="@drawable/sfa_new_version_logo"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<activity
android:name=".Splash"
android:screenOrientation="portrait" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Login"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar" >
</activity>
<activity
android:name=".Prefs"
android:label="@string/config"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".Summary"
android:label="@string/resumen"
android:theme="@android:style/Theme.Dialog"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="com.jvra.signature.SignatureActivity"
android:configChanges="orientation"
android:theme="@android:style/Theme.Dialog"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".System"
android:theme="@android:style/Theme.NoTitleBar"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".find.Finder"
android:configChanges="orientation"
android:theme="@android:style/Theme.NoTitleBar"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".Dashboard"
android:theme="@android:style/Theme.NoTitleBar"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".Help"
android:label="@string/help"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".bprocess.OrdersRecipe"
android:label="@string/help"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".bprocess.DebitNotesProcess"
android:label="@string/help"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".bprocess.CreditNotesProcess"
android:label="@string/help"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".bprocess.StatementProcess"
android:label="@string/help"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".bprocess.Products"
android:label="@string/help"
android:screenOrientation="portrait" >
</activity>
<activity
android:name=".signature.SignatureActivity"
android:label="@string/help"
android:screenOrientation="landscape" >
</activity>
</application>
</manifest>
код метода кнопки назад:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
if(event.getAction() == KeyEvent.ACTION_DOWN)
if(keyCode == KeyEvent.KEYCODE_BACK)
{
DetailFragment detail = (DetailFragment) getSupportFragmentManager().findFragmentByTag(FIND_DETAIL_FRAGMENT);
if(detail != null && detail.isVisible())
searchBar.setEnabledSearchButton(true);
}
return super.onKeyDown(keyCode, event);
}
Я использую это в том же действии, когда приложение выходит из приложения. –
Если это ответ на проблему, не стоит работать на всех устройствах? –
Хм ... Он работает на моих устройствах (HTC Wildfire, Sony Ericsson Xperia и S3), если кто-то может проверить это самостоятельно ... –