java - Running app in the background when going to a new activity -
i have following code opens browser social profile:
imageview iv1 = (imageview) dialog.findviewbyid(r.id.imgfb); iv1.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { uri uri = uri.parse("https://www.facebook.com/profile"); intent intent = new intent(intent.action_view, uri); intent.addflags(intent.flag_activity_new_task); startactivity(intent); } });
now when choose browser open profile, , press back, not closes browser app. way close browser while keeping app running in background?
update:
this works fine:
imageview iv1 = (imageview) dialog.findviewbyid(r.id.imgfb); iv1.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { uri uri = uri.parse("https://www.facebook.com/pagesbyz"); //uri.parse("market://details?id=" + facebookpackagename); intent intent = new intent(intent.action_view, uri); //intent.addflags(intent.flag_activity_new_task); dialog.dismiss(); startactivity(intent); } });
now not receive error when complete action using
window comes , instead of picking option press back, app closes. idea how fix if press goes app rather home?
update: following rewording understand issue better.
in app have image link opens browser, if user has multiple browser installed brings "complete action using" window can choose. if press button should close come app. instead happening is, if press button app closes , taken homescreen
my mainactivity: http://pastebin.com/fvweklat
my androidmanifest:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sikni8.tollculator" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="11" android:targetsdkversion="18" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.sikni8.tollculator.mainactivity" android:label="@string/app_name" android:nohistory="true" 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="com.sikni8.tollculator.currenttrip" android:label="@string/title_activity_current_trip" android:parentactivityname="com.sikni8.tollculator.mainactivity" > <meta-data android:name="android.support.parent_activity" android:value="com.sikni8.tollculator.mainactivity" /> </activity> <activity android:name="com.sikni8.tollculator.displaytrip" android:label="@string/title_activity_display_trip" android:parentactivityname="com.sikni8.tollculator" > <meta-data android:name="android.support.parent_activity" android:value="com.sikni8.tollculator" /> </activity> <activity android:name="com.sikni8.tollculator.showhelp" android:label="@string/app_name" > <meta-data android:name="android.support.parent_activity" android:value="com.sikni8.tollculator.mainactivity" /> </activity> <activity android:name="com.sikni8.tollculator.showsettingoptions" android:label="@string/app_name" > <meta-data android:name="android.support.parent_activity" android:value="com.sikni8.tollculator.mainactivity" /> </activity> </application> </manifest>
how can make sure if user changes mind on not going browser , presses button goes app instead of going home screen?
also fixing above fix, in case goto browser , presses close browser , app come view?
perhaps dialog trying shown activity (your mainactivity) closed... triggering dialog after click imageview?
see this post well. (since logs show "com.myapp.tollculator.mainactivity has leaked window")
Comments
Post a Comment