An Android method for *explicitly* setting the `Activity` content `View`.
Questions tagged [setcontentview]
195 questions
17
votes
2 answers
SwipeRefreshLayout can host only one direct child
I added a "pull to refresh" to my listView, i also wanted to add an empty view when the list is empty - Now i got this error. How can i make this work? if im positioning a view outside of the swipeRefresh and then add it as the emptyView it will…

Yevgeni
- 1,533
- 17
- 32
14
votes
3 answers
Android: is using setContentView multiple times bad while changing layouts?
is using setContentView multiple times bad while changing layouts?
Some people say that it's bad and they never say why.
and is there some other thing to change layout using button?

Brsgamer
- 261
- 1
- 4
- 12
6
votes
3 answers
Drawable already belongs to another owner but does not expose a constant state
Error: Invalid drawable added to LayerDrawable! Drawable already belongs to another owner but does not expose a constant state.
I suddenly noticed this error today, and I'm not sure if it was because I just updated my testing device to Android 8.0.…

eckc
- 488
- 6
- 13
5
votes
3 answers
How can I make BottomSheetDialog match parent height (full screen)
This is the layout that I use:

rosu alin
- 5,674
- 11
- 69
- 150
5
votes
3 answers
How to setContentView before super.onCreate while using AppCompat v22.1.0?
Hey I've just upgraded my app to AppCompat v22.1.0 and got this exception
Caused by: java.lang.IllegalArgumentException: AppCompat does not support the current theme features
at…

AruLNadhaN
- 2,808
- 5
- 24
- 42
4
votes
0 answers
FragmentActivity: cannot resolve setContentView
I'm having the problem that for the following activity
public class MainActivity extends FragmentActivity implements UpdateActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
…

toom
- 12,864
- 27
- 89
- 128
3
votes
1 answer
How to identify which layout xml is running currently?
I have to layout xml named activity_layout_1 and activity_layout_2 and one common Activity.
Based on different conditions, I set contentview of the two xml
In a case, I need to check which layout is currently set.
I can get the id as below:
View…

BlackCat
- 1,932
- 3
- 19
- 47
3
votes
0 answers
Reload/refresh a scene after receive remote notification swiftUI
I have this problem. I'm receiving a notification from CloudKit using application:didReceiveRemoteNotification in AppDelegate. I'm able to receive the recordId, fetch it, and save it successfully. The problem is, the scene doesn't refresh.
final…

amervil
- 63
- 3
3
votes
0 answers
What can I use in place of setContentView when converting an Activity to a Fragments
I am trying to convert an Activity to a fragment as follows:
Activity
public class MainActivity extends AppCompatActivity {
private ZXingScannerView scannerView;
@Override
protected void onCreate(Bundle savedInstanceState) {
…
user1682647
3
votes
1 answer
Using Navigation Bar Activity on different Activities with each Activity's content
I am trying to extend other activities into Navigation Bar Activity, I want to use content of the Activity with Navigation Drawer, but when I use setcontentView, Navigation Bar does not work.
This is my Navigation Bar Activity :
:
public class…

Tarun Khatri
- 31
- 2
3
votes
1 answer
java.lang.IllegalStateException: Required view not found even after setContentView()
I am facing a weird problem related to view not found but everything seems to be right with the code (at least to me). Infact the program was working fine till some time back. I am not sure what change that i made causing this issue. Could anyone of…

J28
- 1,080
- 3
- 15
- 25
3
votes
3 answers
How to stop a UIScrollView from scrolling when it reaches the bottom
I have the following code in place to grab the event when a UIScrollView reaches then end of its content view:
- (void) scrollViewDidEndDecelerating:(UIScrollView *) scrollView
{
float currentEndPoint = scrollView.contentOffset.y +…

cdub
- 24,555
- 57
- 174
- 303
3
votes
2 answers
How to display different layouts with the ViewPager?
In Xamarin, I currently have two different activities and I would like to combine these together and use a ViewPager.
One activity uses the following content view: SetContentView(Resource.Layout.MapWithOverlayLayout);
The second activity uses the…

Garry
- 1,251
- 9
- 25
- 45
2
votes
1 answer
android.view.InflateException: Binary XML file line #2
package com.example.provafragment;
import android.annotation.TargetApi;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Build;
import android.os.Bundle;
import…

Ivan Vidussi
- 31
- 2
2
votes
1 answer
Android O device blank screen after addView / setContentview
I recently decided to update my older apps and bring them a little more up to date. In doing so I noticed an odd problem when running them on my new handset (Android O / API Level 29).
My App is essentially a single Activity using OpenGL. This is…

Zippy
- 3,826
- 5
- 43
- 96