android-activity

java.lang.IllegalStateException: Fragment not attached to Activity

北城余情 提交于 2019-12-27 16:34:27
问题 I am rarely getting this error while making an API call. java.lang.IllegalStateException: Fragment not attached to Activity I tried putting the code inside isAdded() method to check whether fragment is currently added to its activity but still i rarely gets this error. I fail to understand why I am still getting this error. How can i prevent it? Its showing error on the line- cameraInfo.setId(getResources().getString(R.string.camera_id)); Below is the sample api call that i am making. SAPI

What are the differences between activity and fragment?

自古美人都是妖i 提交于 2019-12-27 13:39:03
问题 As per my research, there is a significant difference in the concept of backstack and how they exist: Activity When an activity is placed to the backstack of activities the user can navigate back to the previous activity by just pressing the back button. Activity can exist independently. Fragment When an fragment is placed to the activity we have to request the instance to be saved by calling addToBackstack() during the fragment transaction . Fragment has to live inside the activity Are there

What are the differences between activity and fragment?

£可爱£侵袭症+ 提交于 2019-12-27 13:38:23
问题 As per my research, there is a significant difference in the concept of backstack and how they exist: Activity When an activity is placed to the backstack of activities the user can navigate back to the previous activity by just pressing the back button. Activity can exist independently. Fragment When an fragment is placed to the activity we have to request the instance to be saved by calling addToBackstack() during the fragment transaction . Fragment has to live inside the activity Are there

What are the differences between activity and fragment?

非 Y 不嫁゛ 提交于 2019-12-27 13:38:13
问题 As per my research, there is a significant difference in the concept of backstack and how they exist: Activity When an activity is placed to the backstack of activities the user can navigate back to the previous activity by just pressing the back button. Activity can exist independently. Fragment When an fragment is placed to the activity we have to request the instance to be saved by calling addToBackstack() during the fragment transaction . Fragment has to live inside the activity Are there

Start Activity inside onReceive BroadcastReceiver

大兔子大兔子 提交于 2019-12-27 12:17:10
问题 I want to start an activity in my onReceive() method. package com.splashscreenactivity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.telephony.SmsMessage; import android.widget.Toast; public class SMSReceiver extends BroadcastReceiver { public static String trigger_message = ""; @Override public void onReceive(Context context, Intent intent) { // ---get the SMS message passed in--- Bundle

How to check if activity is in foreground or in visible background?

删除回忆录丶 提交于 2019-12-27 10:17:37
问题 I have a splash screen on a timer. My problem is that before I finish() my activity I need to check that the next activity has started because a system dialogue box pops-up and I only want to finish() ; once the user has selected an option from the dialogue box? I know that there are many questions on how to see if your activity is in the foreground but I do not know if this allows for dialogue boxes on top of the activity too. Here is the problem, the red is my activity which is in the

How to check if activity is in foreground or in visible background?

…衆ロ難τιáo~ 提交于 2019-12-27 10:13:08
问题 I have a splash screen on a timer. My problem is that before I finish() my activity I need to check that the next activity has started because a system dialogue box pops-up and I only want to finish() ; once the user has selected an option from the dialogue box? I know that there are many questions on how to see if your activity is in the foreground but I do not know if this allows for dialogue boxes on top of the activity too. Here is the problem, the red is my activity which is in the

How to make square (or round) floating activity?

馋奶兔 提交于 2019-12-26 06:18:02
问题 How to make square (or round) floating activty? There's a variant with system alert window, but I don't think it's a good idea. Is there any ways to do this customizing dialog theme? 回答1: You should use a dialog fragment. It is highly customizable. 回答2: Use DialogActivity & make your layout as per your round or square. ref : URL Android custom dialog example Custom Dialog 回答3: Set customized style would change the default corner of activity. 来源: https://stackoverflow.com/questions/31430665

How to make square (or round) floating activity?

╄→尐↘猪︶ㄣ 提交于 2019-12-26 06:17:06
问题 How to make square (or round) floating activty? There's a variant with system alert window, but I don't think it's a good idea. Is there any ways to do this customizing dialog theme? 回答1: You should use a dialog fragment. It is highly customizable. 回答2: Use DialogActivity & make your layout as per your round or square. ref : URL Android custom dialog example Custom Dialog 回答3: Set customized style would change the default corner of activity. 来源: https://stackoverflow.com/questions/31430665

How can we call one fragment from another class that doesn't contain that fragment?

邮差的信 提交于 2019-12-26 04:58:19
问题 I am having one activity class : IdeaBoxActivity Here is the layout code of the activity- <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.asif047"> <android.support.v4.widget.DrawerLayout android:layout