android-activity

How to start the activity that is last opened when launch an application?

我的未来我决定 提交于 2020-01-06 23:52:00
问题 I designed an app with several activities. There is only an activity instance in the back stack at any time. When I quit the application from an activity named AcitivityOne, how could I launch the application with ActivityOne next time? 回答1: The fast method, is that in your onCreate() put those flags after setContentView() : if ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT) != 0) { finish(); return; } Also you can create a SharedPreferences with the Activity last oppened as

Kill other process in Android

余生颓废 提交于 2020-01-06 20:37:42
问题 Can I end or kill other process running, programmatically? I'm asked my friend and tell me should using something like kiosk mode !! Could anyone help me to solve this problem .. All regards and thanks. 回答1: Recently I was investigating the same question, because I got tired of manually having to close the Google Maps application that regularly automatically opens and keeps running in the background and draining my battery... But I don't think that Android lets you kill any processes but your

Closing my Android app in my main activity on back pressed

[亡魂溺海] 提交于 2020-01-06 19:59:58
问题 I have two activities: A: a Splash Screen B: the Main activity When the application starts, I show the splash screen with a short video then call B. I want the user to be able to close application with the back button in activity B. (The user shouldn't see splash screen again.) 回答1: You can set android:noHistory="true" for the splash screen in the manifest. This will not add the activity to the back stack. <activity android:name="SplashScreen" android:noHistory="true" <intent-filter> <action

How to get a result data to edit text without clicking on button?

房东的猫 提交于 2020-01-06 19:58:12
问题 I created a converter app, I used 2 edit text one which gets input and other display output it will display output by clicking on button is there any way to get the output display in 2 edit text without using click event of button. I want to get result automatically placed in 2 edit text when we enter input in 1 edit text. EditText input,result; input = (EditText) findViewById(R.id.ip); result = (EditText) findViewById(R.id.res); // my edit texts input and result result.setClickable(false);

Android using shared preference and Dispatcher activity, to get back to the last activity (after reboot the phone)

人走茶凉 提交于 2020-01-06 19:57:14
问题 I'm using a Shared Preferences to save the state of my application to be able to get to the last activity before my Android Handphone got re-boot-ed. My purpose is when Android system manage the memory and push out my apps, when users re-enter to the apps, they will get to the last Activity and screen of my apps. And this is some of my code : First is DispatcherActivity.java : > package com.lm.rosary; > > import android.app.Activity; import android.content.Intent; import > android.content

How to make a listener when a user start typing?

你离开我真会死。 提交于 2020-01-06 19:10:15
问题 I am designing a chat application using android studio and fire-base and got stock on how to make a listener like if the user is typing on the edit-text field The value of the user on fire-base will changed into true and when the user is not typing the value will become false.? I am looking for this solution for about a week, and didn't find any answer regarding on my researches. How to put TextWatcher? public class MainActivity extends AppCompatActivity{ private EditText editText; private

Send not serializable data to new Activity

孤者浪人 提交于 2020-01-06 18:43:52
问题 I have not serializable data which I must sent to other Activity . I try to use Intent , but it's impossible. Intent intent = new Intent(v.getContext(), UserDetailActivity.class); intent.putExtra("class", user); v.getContext().startActivity(intent); How can I send the data from previous Activity to new Activity ? 回答1: I don't think you can do this bacause the ParseUser needs to implement either Parcelable or Serializable. You probably can't modify the class so this is what you can do: Create

Problem calling activity from another package in Android

房东的猫 提交于 2020-01-06 17:14:42
问题 Situation: I need to combine several apps into one .apk app. Lets say implement app2 into app1 What i have done: Copied app2 package into main app1 project which i am working, so my app1 has two packages. app2 had this manifest file: <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.package.app2" android:versionCode="3" android:versionName="1.2"> <application android:label="App2" android:icon="@drawable/icon"> <activity android:name="Activity1" android

Issue starting activity from non-activity class

夙愿已清 提交于 2020-01-06 15:39:12
问题 I am a noob to android and I have a Map Activity that also uses OverlayItems. Within the onButtonTap method of my overlay class, I want to execute startActivity so i can then use intent.ACTION_CALL. Intent callIntent = new Intent(Intent.ACTION_CALL); callIntent.setData(Uri.parse("tel:"+MapActivity.phonenumber0)); startActivity(callIntent); in the code above i am asked to create a method for startActivity(Intent), which I don't understand. and when i try... Intent callIntent = new Intent

setOnItemClickListener is not working in list-view android

为君一笑 提交于 2020-01-06 15:15:53
问题 I am trying to move to other activity by clicking on list item which is loaded in list-view, but i don't why it is not moving to any other activity when i click on any list item nothing happens no crash, not moving to other activity nothing. Can any-one help me please. I searched lot and got so many solution but any of the solution is not working in my case. Please help below is my activity code. public class Classes_Ext_DB extends Activity implements OnClickListener { ImageView