This question already has answers here:
How to pass an object from one activity to another on Android
(35 answers)
Closed 8 years ago.
I have an app MainActivity > ContactActivity > SummaryActivity
On MainActivity I have a text view with directions for the user and once they enter their information I want to get the results from SummaryActivity and post it on MainActivty page. Once the user inputs the information I want the instructions to disappear.
use bundle and pass as extra data with intent ...
see this thread
Passing data from one activity to another using bundle - not displaying in second activity
Related
This question already has answers here:
How to stop EditText from gaining focus when an activity starts in Android?
(54 answers)
Closed 3 years ago.
I have edittext on my Xml layout. When the app launch, keyboard is coming and focusing to edittext. I dont want this. How can I unfocus it on Android Studio ?
set below property of your parent/Top level layout.
android:focusable="true"
android:focusableInTouchMode="true"
and Its working Nicely :)
Use this line in your activity it will hide your soft input
keyboardthis.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
Alternatively, you can use
edittext.clearFocus();
Set this following line with your activity tag in manifest
android:windowSoftInputMode="stateHidden"
or
you can set following line in oncreate method of your activity
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
This question already has answers here:
How to access Fragment's child views inside fragment's parent Activity?
(17 answers)
Closed 5 years ago.
I know how to get an instance of fragment inside an activity from that activity.
but i don't know how to change properties of View objects like TextView,Button inside a fragment from activity.
anybody can help, please give an example for how to do that.
Just use findViewById() from your activity. Once the fragment is attached to the activity and its view is created all views are part of the view hierarchy ergo you can retrieve references to them from the activity
This question already has answers here:
How can i pass image view between activities in android
(2 answers)
Closed 5 years ago.
I want to find out if there is a way to send an entire ImageView to another activity. Is it possible to achieve that with GSON?
You could try wrapping it in a class that implements Parcelable, but I think sending an entire view element to another activity is not really the way to go... Just send the image url and then load an image to an imageview in the other activity.
This question already has answers here:
How can I save an activity state using the save instance state?
(35 answers)
Closed 6 years ago.
I am developing an application in Android Studio and want to make a favourites page. To do this, I would like the user to be able to save the activity to the favourites, and when opening the favourites page from the home page, the user can view the button to start this activity.
I have looked up numerous other similar questions but none which suits my specific issue.
I have looked at different possibilities such as SharedPreferences, ToggleButton etc. but none I can get to work.
I would really appreciate your help.
Thank you so much in advance.
May be you can create a static object of HashMap and save favorite activities to this and can retrieve activities from that. Something like this.
This HashMap Object can be kept in Application Class so you can access user list of fav activities anywhere from the App.
private static final Map<String, Class> favActionMap;
favActionMap= new HashMap<>();
favActionMap.put("FAV_1", AddFixtureActivity.class);
favActionMap.put("FAV_2", AddSwitchActivity.class);
favActionMap.put("FAV_3", CommissionStatusActivity.class);
To store the data persistently ,save it in database or shared preferences
This question already has answers here:
How to stop EditText from gaining focus when an activity starts in Android?
(54 answers)
Closed 7 years ago.
When I travel between Activities my app auto select the first EditText field on the screen, calling the keyboard.
There is any way to start an Activity without selecting anything by default?
You should add this to its parent layout
android:focusable="true" android:focusableInTouchMode="true"