android-activity

Trying to start a Fragment from an Activity.

梦想与她 提交于 2019-12-25 12:15:10
问题 I have a tabbed view which I have implemented using Action Bar tabs, now there are one or two pages which navigate away from this tab view. At some point of time I want to call one of the fragments in the foreground again. But I am not finding any example of how to do this. Class Definition(Fragment1_2): public class Fragment1_2 extends Fragment { Class Definition(AdhocEdit.class): public class AdhocEdit extends Activity{ Activity to Fragment Intent so far: Fragment1_2 fragmentB = (Fragment1

Trying to start a Fragment from an Activity.

别等时光非礼了梦想. 提交于 2019-12-25 12:15:01
问题 I have a tabbed view which I have implemented using Action Bar tabs, now there are one or two pages which navigate away from this tab view. At some point of time I want to call one of the fragments in the foreground again. But I am not finding any example of how to do this. Class Definition(Fragment1_2): public class Fragment1_2 extends Fragment { Class Definition(AdhocEdit.class): public class AdhocEdit extends Activity{ Activity to Fragment Intent so far: Fragment1_2 fragmentB = (Fragment1

Save state of Button in activity Android

房东的猫 提交于 2019-12-25 09:42:23
问题 I have two buttons( button1 , button2 ) in my activty. botton1 is 'Enabled'(true) , while the other one isn't. When I click on button1 , button2 becomes 'Enabled'. I want to record this activity in this state for the next utilization of my application. 回答1: You can save state in sharedPrefrences , try this SharedPreferences prefs = getSharedPreferences("Your preference name here", MODE_PRIVATE) b1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { b2

It is possible to make a HoneyComb activity unclosable?

徘徊边缘 提交于 2019-12-25 08:35:27
问题 I'm developing a presentation style application for HoneyComb Tablets. At one stage the tablet may be passed around a room for people to interact with. If possible I would like to prevent malicious users from navigating away from the current activity. So far I have overwritten the onBackPressed() to prevent finishing the activity but users can still press the other buttons on the status bar and also leave the app via notifications that pop up. Any suggestions or possible solutions? Thanks 回答1

Android: Mediaplayer plays multiple times if I keep on pressing the back button and launch the app again

荒凉一梦 提交于 2019-12-25 08:33:59
问题 When I play my song and press the back button to return to return to home, the music continues playing. When I launch the app again, the music plays twice. I think it's the onResume method because I commented out the method and the problem stopped. How do I get onResume work properly? I tried using if(backgroundMusic.isplaying()) inside the onResume, but the app crashes when I resume from another activity. What am I doing wrong? //global mediaplayer MediaPlayer backgroundMusic; /** Called

Does each Activity need to Bind to a Service & What happens when it was created with startService()

让人想犯罪 __ 提交于 2019-12-25 08:21:53
问题 I have a Service that is supposed to maintain a constant connection with a home automation controller (HAC). In the preferences of the App, I will give the User a choice to stay** connected to the HAC or to drop the connection to the HAC when the App is not in use. I intend to use startService(), with a look at the preferences to see if it's necessary to call stopSelf() from within the Service. I basically have two questions: Is it necessary to Bind to the service from every Activity in the

Create New Activity adds an activity which extends Activity class instead of ActionBarActivity class in Eclipse

眉间皱痕 提交于 2019-12-25 07:48:29
问题 I am a newbie to android and I was following the tutorial on android.developer.com,Where a new Activity creation adds an activity which extends ActionBarActivity by default,but When i create a new Activity it extends Activity class by default I have also tried to set the Min API to 4.1 Jelly Bean and target to 4.4 as ActionBarActivity is available in later API but it didn't work,I have downloaded the Adt bundle from the site 回答1: When you create new project in eclipse, you should select min

PayUMoney - Android: Only getting **paymentId** from payUMoney SDK after successful payment

霸气de小男生 提交于 2019-12-25 07:44:29
问题 I'm integrating payUMoney in my Android application. I'm getting only paymentId after successful payment in both environment i.e Test & Production. I need Transaction Details as well from payUMoney. I have also contacted payUMoney technical team but not getting any response. See image attached for payUMoney response which I have printed in Logcat. What I have tried is like below. public void makePayment() { String phone = "8882434664"; String productName = "product_name"; String firstName =

Android_ How can I send a Bundle to another activity?

雨燕双飞 提交于 2019-12-25 07:39:53
问题 I am trying to send a bundle from one activity to another. When I load the bundle in the recieving activity all the information seems to be null. Here is some code: BaseActivity.java private final DrawerLayout.DrawerListener mDrawerListener = new DrawerLayout.DrawerListener() { @Override public void onDrawerSlide(View drawerView, float slideOffset) { if (mDrawerToggle != null) mDrawerToggle.onDrawerSlide(drawerView, slideOffset); } @Override public void onDrawerOpened(View drawerView) { if

Why is secondary activity being destroyed when going back to main activity? [closed]

白昼怎懂夜的黑 提交于 2019-12-25 07:34:39
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . When going back to activity A (main activity) the activity B is being destroyed. Why is that happening? The example program I'm trying to understand is here: http://developer.android.com/shareables/training/ActivityLifecycle.zip 回答1: Here's a representation of how each new activity in a task adds an item to the