Questions tagged [android-activity]

0

votes
0

answer
15

Views

java lang NoClassDefFoundError on activity start in android 4.4

My application is giving me java lang noclassdeffounderror when i start a new activity. Its working fine with higher version of android api but when i use android api 19 or android kitkat 4.4 its not working. i have checked many answers but none of them is working android { compileSdkVersion 28 defa...
Arsl An
0

votes
0

answer
3

Views

Getting black screen for 3 seconds when moving to another activity?

I am working on an app which on moving from Activity 'A' to another Activity'B' shows black screen for 2 to 3 seconds. I am performing calculation on huge amount of data in Activity 'B', so on moving to Activity 'B' due to load on mainUI it gives black screen to load. But when i move my calculation...
dan walker
1

votes
2

answer
3.8k

Views

How to programmatically change title bar colour to hex value?

Is it possible to change the colour of the title text within the action bar to a colour of a hex value? I'm only aware of the following and have no idea if this can be achieved: setTitleColor(Color.Green);
MacaronLover
1

votes
2

answer
1.2k

Views

Shared element transition not working- I can't resolve method ActivityOptionsCompat.makeSceneTransitionAnimation(mContext, p1, p2);

I'm trying to start an activity with shared element transition from recycler adapter. Here is the snippet:- @Override public void onBindViewHolder(final ViewholderPostFeed holder, final int position) { holder.post_header.setOnClickListener(new View.OnClickListener() { @Override public void onClick(...
Asif Ali
1

votes
0

answer
73

Views

Access data in Adapter From Activity

i want to access data inside Adapter from Activity, and then i will passing the data from activity to call API.. here is my data inside PremiumAdapter.java : public class PremiumVideoAdapter extends RecyclerView.Adapter { static List data; public PremiumVideoAdapter(List data) { this.data = data; }...
asqa
1

votes
0

answer
239

Views

tabbed activity not showing any tabs

If I try and create a new project with a tabbed activity, no tabs show. Call me crazy, but I'd actually like tabs on my 'tabbed activity'. I searched on Youtube and it seems tabs just come up for others. Did something change with the newest version of Android studio? How do I add actual tabs and...
Matt
1

votes
0

answer
27

Views

Activity always on top [Check out bar]

I have an shopping app and when a customer adds an Item to the shopping cart a bar should appear in the bottom part of the screen, providing the customer to checkout or edit the cart. This bar should stay in the bottom of the screen until the customer reset the cart or checkout, and it may display r...
Joel Broström
1

votes
0

answer
185

Views

Android - Start Activity on Phone Boot Not Working

I'm trying to add a BroadcastReceiver to my program that will launch my MainActivity when the BOOT_COMPLETED action is detected. I've tried everything here and here and it refuses to work. I am running Android 5.1.1, API 22. AndroidManifest.xml In the , I've tried using both BOOT_COMPLETED and QUI...
Eirhardt
1

votes
1

answer
237

Views

How to view different images on one activity layout by clicking on 5 different buttons

I have two activity layout in Android Studio project one is main_activity and second is imageview_activity. Main_activity have 5 buttons for 5 images which store in drawable. how to code it when i click on button it show image on imageview layout. 5 different images on one layout imageview_layout.
Abdul Rahim
1

votes
1

answer
29

Views

How to pass currentLocation ActivityOne to ActivityTwo?

I am trying to pass the currentLocation from ActivityOne to ActivityTwo but it passing the null values. In my activityOne if the user is logged in already it will redirect to another activity. private void nextActivity(){ Intent main = new Intent(FirstActivity.this, ListActivity.class); main.addFlag...
MichaelB
1

votes
1

answer
48

Views

Setting Default Launcher to Continue Last Activity

I'm working on Kiosk mode in Android and my application has multiple Activities. Lets say they are Activity A, Activity B, Activity C. I'm setting Default Launcher in Activity A. Here is how I do it. PackageManager packageManager = getPackageManager(); ComponentName componentName = new ComponentName...
Emre Alparslan
1

votes
1

answer
261

Views

FragmentStatePagerAdapter view pager fragments not showing after activity recreate

When my Activity gets recreated via orientation change or if 'Don't keep activities' is turned on in developer settings, my ViewPager that has FragmentStatePagerAdapter doesn't recreate fragments. this is activity onCreate method: @Override protected void onCreate(@Nullable Bundle savedInstanceStat...
choki1708
1

votes
1

answer
54

Views

How to set the value of a Progression bar from a different activity?

I have a int value in MainActivity and I want to move it in the second activity and there set it as a value for a Progression bar. I tried the following situation but it doesn’t seem to work. Any tips will be appreciated. MainActivity: public void subQ8Clicked(View v) { calculateScore(); Q7.setVis...
Posa Bogdan
1

votes
0

answer
20

Views

How to change code from fragment to activity

I am new to android and have faced some problem, I am making a StudentArraylist to view the student from my firebase database to show them in ListView. But I face some problem because the code I have now I meant for fragment but not activity and Here is my error This is the ViewStudentActivity Stude...
Yong Chin Lam
1

votes
2

answer
212

Views

How to update adapter items in previous activity in stack when user presses the back button?

I have a RecyclerView list, and an items passes to it's adapter. Now when I click a row in this list, it will show the details of the pressed item. Let's say I need to toggle the selected item as liked or disliked, as each item in the dataset will have isLiked property with either true or false valu...
Ammar Alrefai
1

votes
0

answer
187

Views

Android Exit/Enter Transition

I'm trying to implement an exit transition for my MainActivity and it does not work. If I'm trying to select a certain view it always results in a crossfade of both activities. //Results in a Fade getWindow().setExitTransition(new TransitionSet()); //Results in a Slide getWindow().setExitTransition...
Epig
1

votes
3

answer
51

Views

Retrieving same value of an arrayList between two activities

I have an array which is created in activity_1, and must be used in activity_2. How did I do this ? I created a class (array_provider.class) which will implement the getter and setter of this array. So in activity_1, I initialise an object of array_provider then I used it to create my array. In ac...
Diridou
1

votes
2

answer
371

Views

How can I set a maximum height for a Scroll View in an Activity?

What I want to achieve: A java Activity with a belonging xml-layout, where the user can enter the names of all players. Here is how it looks like: If you click the plus-button you can enter another player (Spieler is german for player). It should be a wrapped view until the maximum height is reache...
Nina Seil
1

votes
0

answer
198

Views

Activity Enter- and Exit-Transition on the same time without fading

I want to create an Activity Transition with the Transition-API in Android KitKat. Activity B shall slide up over Activity A. Activity A shall stay. Code Activity A: getWindow().setExitTransition(TransitionInflater.from(getBaseContext()).inflateTransition(android.R.transition.no_transition) .setInte...
M.Fleck
1

votes
1

answer
79

Views

avoid app exit on pressing back button

I have one main activity and one adapter in a file manager app.So when I open a folder in the app, then open a subfolder, and then press back button, its back to the home screen/main screen. I want to go back to the subfolders screen on pressing Back, then to the folders screen on pressing back, the...
natalie jkb
1

votes
0

answer
33

Views

Attach multiple files in Gmail fails to send - ACTION_SEND_MULTIPLE

I need to attach multiple files in mail. The count increases as per user entry. The minimum attachment count is 2. When I try attaching 2 files and send using new Intent(Intent.ACTION_SEND_MULTIPLE), it sends and receives perfectly without any issues. If I attach more or equal 4 files, it shows in a...
Joseph
1

votes
1

answer
127

Views

How To Load Layout Background Using Picasso and cache it

I have View (LinearView) with a drawable on it's background. How can I save Drawable in onSaveInstanceState to increase showing speed? Actually picture is downloaded from the Internet, and when it's downloaded it is set as View background. If background!=null in onResume() I shouldn't load it from t...
Ening
1

votes
0

answer
61

Views

Passing file descriptors from one Activity to other

I am trying to pass a FileDescriptor from one activity to another. The only way i found out was to use Parcel and pass a ParcelFileDescriptor. But the ParcelFileDescriptor is duplicate of the original Filedescriptor with different fd. I want the same fd to be passed to the other activity. Is there a...
M.Dev
1

votes
0

answer
43

Views

Which lifecycle callbacks are called when quick settings menu is opened?

Hi i have an (Main) activity which hosts (Match) fragment. I want to get notified when quick settings menu is opened. On MatchFragment i tried to overwrite methods as onStop(),onResume(),onPause() and in MainActivity i did the same. I put logs in every callback to see which of them is being called w...
MarkyMark
1

votes
1

answer
122

Views

service keep crashing on OnDestroy()

I'm creating a service that runs a mediaplayer for a set period of time.This service gets a constant value that I defined in another class and based on that the duration of the playing is determined. I looked all over the web but couldn't find a solution or a similar problem , spent hours trying to...
Xemega
1

votes
2

answer
361

Views

Android Activity is recreated when activity from background(pause) to foreground

Hi Android professionals, I fell into a small issue about some activity life cycle. I mentioned my problem with step by step:- launch the app with app icon from home screen. Enter some data into a edit text fields in recyclerview in activity A. press the home button and launch the other app(any app...
krish
1

votes
1

answer
32

Views

Webview app, back smartphone button

I recently started to program with Android studio, I came across a problem. I created a Webview application, and I would like to press the back button on the smartphone once you go back to the previously viewed page, while pressing it twice in a row will exit the application. For now I only managed...
Simone.P
1

votes
2

answer
191

Views

Disabling the back button on an activity when a dialogfragment is shown

I have an activity that shows a dialogfragment. I've already set the dialogfragment cancelable to false, but the underlying activity still captures the back button press. My underlying activity has overridden the onBackPressed method, but I don't want this to run when the dialogfragment is shown. Ho...
Poly Bug
1

votes
1

answer
279

Views

Java-Send data from activity to tab fragment in Android Studio [duplicate]

This question already has an answer here: Passing Data Between Fragments to Activity 6 answers I am new to Java. The activity is to receive an ID and reuse that ID to get the detail of the recipe with a Recipe API. I am using three tabs to show different content. The problem that I could not figure...
Tianyi Zhang
1

votes
1

answer
36

Views

Activity reopening is working only once

I have receiver and when some action is happening I need to reopen current activity(I am in HideSettingsActivity and I want to close that Activity and open the new one HideSettingsActivity). For this I'm just finishing current activity and open the new one via intent. Code below. Intent reopenCurren...
Taras Stavnychyi
1

votes
1

answer
56

Views

Application restarts while navigating back to previous activity

See I have 3 activities, A, B and C. I go to activity C from A. A -> B -> C While in activity C, press home button and leave it for some long time. When I bring application back to foreground after some long inactivity either from application back stack or from launcher icon, I land on activity C....
Braj
9

votes
9

answer
30k

Views

I want to transfer the image from one activity to another

I have to transfer the image from one activity to another. In first activity the user selects the image out of several images from scroll view and that image has to be displayed in the imageview of next activity. Help required.
Arslan Ali Khan
1

votes
0

answer
241

Views

How to start new activity and clear back stack

Hello i got stucked and have no idea how to solve my problem. So i have an app where i have a fragment. From my fragment I can start 2 diffrent activities (lets call it activity1 and activity2). When i start the activity1 user encounters chain of activties A->B->C->D (where back button is supposed...
Szuler
1

votes
2

answer
69

Views

Launching a specific Activity from an Alarm - even when application is closed

I'm looking to use AlarmManager to launch a specific activity (ie. not my main one) and cannot seem to figure out how to do it. I can launch the main activity (the one that opens when the application is launched normally) using the code found in another answer, but I want to launch a specific activ...
Mitchell S
1

votes
1

answer
102

Views

Is there any callbacks which help to detect when application gets killed (swipe, app crashed)?

Unlike Activity, which has a clear lifecycle (onCreate ... onDestroy), Application only has onCreate method. I want to handle some events when the app gets destroyed, but yet find any solution for this. I have read some topic related to this issue, they suggested me to use Service. Does anybody have...
Krot
1

votes
0

answer
73

Views

Android - Activity Destroyed when Rotating Tablet

I have the following problem in my application:: When the user shuts off the screen on the tablet, turn on again, rotate to vertical and unclock the lockscreen, the Activity was destroyed and the app return to the login screen of the application. This problem only occurs in Activity that has a list...
P. Dev
1

votes
1

answer
23

Views

How to Show Fragments based on user role stored in Shared Preference after successfull login

I am getting user role in response after successfull login using Volley.I have stored role in SharedPreferences. JsonObjectRequest request=new JsonObjectRequest(Request.Method.GET, whoAmIUrl, null, new Response.Listener() { @Override public void onResponse(JSONObject response) { try { String whoIAm...
Satyam
1

votes
1

answer
105

Views

I called an intent to launch activity. But it take more time to launch

activity take more time to launch. Here is my code Intent intent =new Intent(getActivity(), McallContactsActivity.class); startActivity(intent); I have disabled instant run, then tried. But it will take more time to lanch activity. @Override protected void onCreate(Bundle savedInstanceState) { supe...
Shifu
1

votes
1

answer
73

Views

On Finish activity in Android

Im trying to integrate Tapresearch survey in my android app. The company provides an SDK. The SDK gives the ability to use events listeners. One of the listeners doesn't work which is onSurveyModalClosed()` where normally the app resumes running. All other listeners works fine except this one. When...
Fat-Bee
1

votes
1

answer
155

Views

OnResume from specific activity

Im integrating TapResearch in my Android app. As mentioned here in the documentation https://www.tapresearch.com/docs/android-integration-guide that the to show the survey I need to use TapResearch.getInstance().showSurvey();. This method open an activity from the library. In the documentation ther...
Fat-Bee

View additional questions