android-activity

Android Intents: Start activity using class name from another app that has the same sharedUserId

南笙酒味 提交于 2020-01-02 00:47:09
问题 All my apps have the same sharedUserId. I would like to start a class of another app using the class of my current app. I want to use intent extras but I do not want to use intent URLs. I also would prefer not to have to change the AndroidManifest of my target activity's app. 回答1: Its pretty easy since you have the sharedUserId set. Intent res = new Intent(); String mPackage = "com.your.package"; String mClass = ".actYouAreLaunching"; res.setComponent(new ComponentName(mPackage,mPackage

Using single Class in multiple Activities

一世执手 提交于 2020-01-01 19:40:15
问题 I implemented a class called WebSocketClient which provides the functionality to open and connect to a websocket, send data through the websocket, etc... Now I want to use this class in my Activities. In order to be informed of incomming messages from the websocket i created a WebsocketListener which can be registered in the WebSocketClient so the activity which would like to communicate through the Websocket would implement this interface and register itself. The problem is, how can I use

How to animate just one Activity when Activity change?

痞子三分冷 提交于 2020-01-01 19:36:52
问题 When change from Ativity A to Activity B and viceversa I want that only Activity B to animate, but in my case Activity A also animates.(leaving a blank space in the left of the screen) Activity B animation is working well, my problem is with the animation of Activity A .(which shouldn't exists). I have set //Activity B @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); overridePendingTransition(R.anim.fadein, R.anim.fadeout); setContentView(R

How can I animate one single item (entry) after the List is already updated and drawn?

情到浓时终转凉″ 提交于 2020-01-01 19:17:31
问题 I have this main ListView (retrieved using this.getListView() ) in a ListActivity properly populated from a SQLite database. A click on one of its items (entries) calls another activity A2 using startActivityForResult() . I would like to animate that SINGLE entry WHEN the user gets back to the ListActivity. (So I suppose I need to override the onActivityResult() method) How can I animate a single entry once the window gained focus and after the list is updated using notifyDataSetChanged() ? I

Unable to switch from Fragment to Activity / Activity to Fragment in Android Programming

感情迁移 提交于 2020-01-01 19:06:23
问题 Currently, I am mainly using Fragments to connect to Facebook. However, for the other codes, I am using normal activites (no Fragments). My issue now is that I wish to have a button to link from my "Home Page" to the Fragment, and from the Fragment back to my "Home Page" I am unable to do so. I tried to use the same code to switch between activities for this but it does not work. Is there a way to Link Normal Activities to Fragments and Vice Versa ? Or can they only link to each other ? This

Can an activity be killed with just onPause?

China☆狼群 提交于 2020-01-01 18:51:08
问题 This is what I read from a book: The activity can be destroyed silently after onPause(). We should never assume that either onStop() or onDestroy() is called. But according to the documentation, Pause refers to partly visible, can an activity partly visible be killed without calling onStop or onDestory? 回答1: There is no guarantee that onStop or onDestroy will be called. In situations when memory is severely lacking, the partially visible and out-of-focus Activity may be destroyed to reclaim

New Android 4.0 Screen Transitions Between Activities

一曲冷凌霜 提交于 2020-01-01 18:27:47
问题 I have been developing an Android app for a few months now and started testing on android 4.0. I just noticed that they changed the default transition between screens isn't that slide old off new on transition but instead some kind of popup the new from background like in iPhone. Does anyone have any more info on the transition, is it configurable? If so where is it in the API I couldn't seem to find it. 回答1: Use this to control the screen transition in android: overridePendingTransition You

v7-21 ActionBarActivity not showing the app main icon on the left

孤人 提交于 2020-01-01 18:23:59
问题 I implemented a basic activity as public class MainActivity extends Activity and when I add an actionbar with the menu as below, the app icon defined in the AndroidManifest.xml shows up nicely <application android:allowBackup="true" android:icon="@drawable/logo_green" android:label="@string/app_name" android:screenOrientation="portrait" android:theme="@style/Theme.AppCompat.Light.DarkActionBar" > When I try to change to android.support.v7.app.ActionBarActivity ( and switch to compatible

Calling the finish() method of an Activity from a BroadcastReceiver

隐身守侯 提交于 2020-01-01 17:06:45
问题 I have 2 Activities (Activity1, Activity2) and a BroadcastReceiver class Assume that we are now on Activity2, where I set up an AlarmManager to run at a specific time. Is there a way to call the finish() method of Activity2 within the onReceive() of the BroadcastReceiver? My goal is to return to Activity1 from Activity2 without starting a new Intent in onRecieve(). Note: The BroadcastReceiver class is not registered within the Activity of Activity2. It is registered in the AndroidManifest.xml

How to redirect User to default launcher in an android app?

依然范特西╮ 提交于 2020-01-01 16:49:39
问题 It's been now a long time since I try to figure out how to develop a android unlock screen app working with an NFC authentication. I am working with a Nexus S. After several researches on the Internet, I came to the conclusion that replacing the lock screen as a third party app is just not supported right now and that we need to modify the platform to do a decent implementation. This is the reason why I developed an home screen app that give the illusion of an unlockscreen app. But my problem