android-activity

How to bring most recently used third party Activity to front?

半腔热情 提交于 2020-02-01 05:21:30
问题 In my app, I want to programmatically bring the most recently used third party Activity to the front. After looking at other answers here, I've tried relaunching the activity using the baseIntent returned from a list of recent tasks, but that does not seem to bring the activity to the front over whatever else is going on. My end goal is to create an app that replaces the incoming call screen with a small overlay so the user is not pulled completely out of whatever app they are using when they

How to implement dialog like truecaller

前提是你 提交于 2020-01-30 14:34:20
问题 I am trying to implement the app similar to true caller,I am able to get the phone number when the phone rings using broadcast receiver and opening the MyCustomDialog Activity This is my receiver class by which I am getting the Call State that the call is starts or ends. In this, I make some methods which I am using in CallReceiver.java PhonecallReceiver.java import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.telephony

Is there a method to clear all the task in an app (Android)?

…衆ロ難τιáo~ 提交于 2020-01-30 13:19:07
问题 Quick question, just want to know if i have 2 tasks in my project. Is there any way to clear both of them in a single go. This is because when i try to clear both task to quit my app, only one is clearing and the another one is still alive which prevents me from quitting the application. finishAffinity(); int pid = android.os.Process.myPid(); android.os.Process.killProcess(pid); Any suggestions to solve this ? 回答1: Yes, You could use: FLAG_ACTIVITY_CLEAR_TOP FLAG_ACTIVITY_SINGLE_TOP FLAG

How To Solve Editext in More Numbers in a Layout And Get Values From That?

拜拜、爱过 提交于 2020-01-30 06:24:30
问题 See this picture: I am designing a sudoku in android, have done the layout like this, so 81 Editext is there. I want to get all the values in the Editext so its difficult to declare and mange 81 views in activity. Can you suggest me a method which is effective for processing my problem? 回答1: I would suggest you to use array of Edittext's like this EditText text1,text2,text3,text4,text5,text6,text7,text8,text9, text21,text22,text23,text24....text 99; EditText[] fields={text1,text2,text3,text4

How to clear the Android Stack of activities?

痞子三分冷 提交于 2020-01-26 23:54:11
问题 I have an application with several Activities in Android and I want the user to be able to log-out by pressing a menu button. The problem I have is that A) Android doesn't let you terminate the application and B) even when I send the user to the LoginActivity again they can always press back and get right back to the previous activity they were in. I already tried to launch the Activity with the two following flags: Intent intent = new Intent(this, LoginActivity.class); intent.setFlags(Intent

Android Fragment onCreateView vs. onActivityCreated

喜夏-厌秋 提交于 2020-01-26 21:56:49
问题 I know that a fragment's view hierarchy has to be inflated in onCreateView, but what other functionality can be in onCreateView vs. what should wait for onActivityCreated? My current implementation uses separate activities for everything, and a typical activity does most of its work in its onCreate method, including inflating the view, setting the content view, initializing the various widgets with data, setting up listeners, etc. So can this probably all be moved into onCreateView, or should

Android Fragment onCreateView vs. onActivityCreated

时间秒杀一切 提交于 2020-01-26 21:56:24
问题 I know that a fragment's view hierarchy has to be inflated in onCreateView, but what other functionality can be in onCreateView vs. what should wait for onActivityCreated? My current implementation uses separate activities for everything, and a typical activity does most of its work in its onCreate method, including inflating the view, setting the content view, initializing the various widgets with data, setting up listeners, etc. So can this probably all be moved into onCreateView, or should

Android Fragment onCreateView vs. onActivityCreated

一个人想着一个人 提交于 2020-01-26 21:55:06
问题 I know that a fragment's view hierarchy has to be inflated in onCreateView, but what other functionality can be in onCreateView vs. what should wait for onActivityCreated? My current implementation uses separate activities for everything, and a typical activity does most of its work in its onCreate method, including inflating the view, setting the content view, initializing the various widgets with data, setting up listeners, etc. So can this probably all be moved into onCreateView, or should

Android Fragment onCreateView vs. onActivityCreated

空扰寡人 提交于 2020-01-26 21:54:58
问题 I know that a fragment's view hierarchy has to be inflated in onCreateView, but what other functionality can be in onCreateView vs. what should wait for onActivityCreated? My current implementation uses separate activities for everything, and a typical activity does most of its work in its onCreate method, including inflating the view, setting the content view, initializing the various widgets with data, setting up listeners, etc. So can this probably all be moved into onCreateView, or should

startActivity() from BroadcastReceiver

余生颓废 提交于 2020-01-26 09:47:07
问题 I am trying to autostart my nightclock application on charging using the following BroadcastReceiver implemented in the onPause() method: BroadcastReceiver test = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { unregisterReceiver(this); Intent i = new Intent(context, NightClock.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } }; registerReceiver(test, new IntentFilter(Intent.ACTION_POWER_CONNECTED)); The onReceive()