android-activity

Pass interface between activities in intent - interface fails to be Serializable or Parcelable

冷暖自知 提交于 2021-02-08 12:20:14
问题 I want to pass an interface from 1st activity to 2nd activity. I want to initiate methods from the interface from the 2nd activity which will affect the 1st activity. I'm well aware that it's very overkilling not using the onActivityResult mechanism, and that it might not be good programming, but roll with me please. Here's the issue - my interface can't implement Serializable / Parcelable since interface can't implement another class. This is my interface : public interface ITest { void

Android Studio doesn't show new Activity option

自古美人都是妖i 提交于 2021-02-08 08:58:23
问题 My android studio doesn't responding well. It does not show new Activity option. Even it does not display other option too . I Cleaned and rebuild the project . Even I restart Android studio several times too . Please Help me to solve this issue. 回答1: I ran into this same issue and tried numerous things that I found online but nothing worked. Then I just started trying out random things and when I ran "File -> Sync Project with Gradle files" it started working for me. I can now create

Proper way to start and stop DayDream service from activity

寵の児 提交于 2021-02-08 08:55:23
问题 I am developing an application which should display a daydream in special circumstances, I searched everywhere to find a proper way to start my daydream service through my MainActivity class with no luck, Currently i am using following code to start daydream and actually it works, but i need a better solution which provides me a way to stop the daydream. public void startDayDream(){ final Intent intent = new Intent(Intent.ACTION_MAIN); try { // Somnabulator is undocumented--may be removed in

Which way is better for pass a large list of data from one activity to another activity - android?

谁说胖子不能爱 提交于 2021-02-08 08:48:39
问题 I need to pass a large list of data from one activity to another activity ,which way is better? First way(for example): ArrayList<myModel> myList = new ArrayList<myModel>(); intent.putExtra("mylist", myList); Second way(for example) : ActivityTwo act = new ActivityTwo(); act.getDataMethod(listValues); Intent i = new Intent(this, ActivityTwo.class); startActivity(i); And in another activity (ActivityTwo) I get data from getDataMethod . 回答1: Best way to pass large data list from one Activity to

How to change data of Main Activity from Fragment [closed]

瘦欲@ 提交于 2021-02-08 08:00:40
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 5 years ago . Improve this question I Have fragment 1, fragment 2, fragment 3 which are in the Main Activity. there is a TextView in the main Activity, how can the fragments change the text in the text view? I already did the casting (Actvity).getActivity but i don't want my app to have error when changing

How to Refresh Current Activity once after load?

℡╲_俬逩灬. 提交于 2021-02-07 11:14:15
问题 How to refresh current Activity 1 time after load? My code refresh the activity, but in Loop. This site have some examples, but most is after click button. Isn't my case.. My code is: finish();startActivity(getIntent()); sry my english.. 回答1: just do this way. startActivity(getIntent()); finish(); 回答2: public class MainActivity extends Activity { String url; //initializing WebView private WebView mwebView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate

How to Refresh Current Activity once after load?

﹥>﹥吖頭↗ 提交于 2021-02-07 11:13:35
问题 How to refresh current Activity 1 time after load? My code refresh the activity, but in Loop. This site have some examples, but most is after click button. Isn't my case.. My code is: finish();startActivity(getIntent()); sry my english.. 回答1: just do this way. startActivity(getIntent()); finish(); 回答2: public class MainActivity extends Activity { String url; //initializing WebView private WebView mwebView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate

All items merges to top left in constraint Layout , Android Studio [duplicate]

余生长醉 提交于 2021-02-07 10:55:19
问题 This question already has answers here : ConstraintLayout views in top left corner (5 answers) Closed 3 years ago . I am a beginner this is what it looks when i run my app . i am using latest version of Android studio. having constraint Layout as default here are the screenshots This is what it shows https://drive.google.com/file/d/0B-ydaOiOKnYnOG1oODVoZEtwRzA/view?usp=drivesdk This is what im trying to design https://drive.google.com/file/d/0B-ydaOiOKnYnQ2NKSXdZencxYk0/view?usp=drivesdk Help

SecurityException: Permission Denial: While launching Activity via explicit intent

霸气de小男生 提交于 2021-02-07 10:15:28
问题 I was reading about declaring permissions in activity . According to the documentation You can use the manifest's tag to control which apps can start a particular activity. A parent activity cannot launch a child activity unless both activities have the same permissions in their manifest. If you declare a element for a particular activity, the calling activity must have a matching element. To try this out, I created 2 sample Apps. First App will try to directly launch an activity of the

SecurityException: Permission Denial: While launching Activity via explicit intent

痴心易碎 提交于 2021-02-07 10:13:36
问题 I was reading about declaring permissions in activity . According to the documentation You can use the manifest's tag to control which apps can start a particular activity. A parent activity cannot launch a child activity unless both activities have the same permissions in their manifest. If you declare a element for a particular activity, the calling activity must have a matching element. To try this out, I created 2 sample Apps. First App will try to directly launch an activity of the