android-activity

Android: how to pass ArrayList<object> from an activity to another

你离开我真会死。 提交于 2019-12-31 02:55:41
问题 The object in the arraylist is defined in an external library. The object contains some int values and also a float[]. How can I pass all the ArrayList from an activity to another? Thanks! By the way, I do not have the control of the object class. 回答1: It depends on the type of object that's in the array list. If you have control over it and can have it implement Parcelable, then you can use Intent.putParcelableArrayListExtra . Another approach is to extend Application and store your

How can I send message from HostApduService to an activity? [closed]

为君一笑 提交于 2019-12-31 02:19:28
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . I would like to pass a string to an Activity easily. Something like callback would be needed because when the string has to be passed then the Activity has to do something. public class MyHostApduService extends HostApduService { @Override public byte[] processCommandApdu(byte[]

How to implement a ProgressDialog while Activity requests a SoapObject from a Web Service?

大憨熊 提交于 2019-12-31 02:14:36
问题 I know that ProgressDialog with Threads questions have been asked many times but none of the solutions seem to work for my project. Basically what I want to do is this: 1) when a user clicks a button the Activity sends an auth request to the server 2) while this is being done a ProgressDialog is shown 3) when the reponse comes I want to dismiss the ProgressDialog and the return object to be read and interpreted by the Activity If I: 1) set the Thread to update the Application field with the

Global TTS in Android

本秂侑毒 提交于 2019-12-31 01:51:09
问题 Hi I am devloping an application for blind users so that I use very often text to speech as practicaly the only one method how to respond on user actions. I decided to make one global TTS instance running as long as the app. I have implemented it this way package com.simekadam.blindguardian; import android.content.Context; import android.speech.tts.TextToSpeech; import android.speech.tts.TextToSpeech.OnInitListener; public class SpeechHelper implements OnInitListener { private static

Activity be killed when press HOME only in release mode

混江龙づ霸主 提交于 2019-12-31 01:46:34
问题 First, I have two activities: Splash and MainActivity ( only support portrait). In MainActivity, I have many fragments use Slide menu. I want to keep current fragment when user leave MainActivity. Here is my try: int currentFragment = 0; public void onCreate(Bundle savedInstanceState) { if (savedInstanceState != null) { currentFragment = savedInstanceState.getInt(CURRENT_FRAGMENT_KEY, 0); switchContent(currentFragment); } else { // change fragment by index switchContent(0); } } @Override

How to create BroadcastReceiver without Activity/Service?

柔情痞子 提交于 2019-12-31 00:55:09
问题 I'm trying to create BroadcastReceiver without activity/service. While I've no problem registering and executing the code when an activity is present in the code when I remove the activity it fails. I do register the BroadcastReceiver using the manifest(!) But it is not being called when the activity is removed from the project. <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <receiver android:name

Android Activity onCreate Being Called Twice When Navigated Back From Another Activity

a 夏天 提交于 2019-12-30 23:44:12
问题 I have an app that generates music after a user authenticates with OAuth on a webview activity, looking something like this: main player activity-OAuth Activity-back to main player activity. However, the onCreate method is being called twice when going from the OAuth activity, resulting in two audio tracks generated and played at the same time. Here's part of the code from the MainActivity: public class MainActivity extends Activity { int pitch=60; private static final float VISUALIZER_HEIGHT

Android Activity onCreate Being Called Twice When Navigated Back From Another Activity

余生长醉 提交于 2019-12-30 23:43:51
问题 I have an app that generates music after a user authenticates with OAuth on a webview activity, looking something like this: main player activity-OAuth Activity-back to main player activity. However, the onCreate method is being called twice when going from the OAuth activity, resulting in two audio tracks generated and played at the same time. Here's part of the code from the MainActivity: public class MainActivity extends Activity { int pitch=60; private static final float VISUALIZER_HEIGHT

Start Activity clearing top in Android

廉价感情. 提交于 2019-12-30 12:36:15
问题 I have the following Activities in my stack: A , B , C, D I want to relaunch B in order to get this stack: A , B' Where B' is a new B instance (not the old receiving a onNewIntent callback, how can I do it? By the way I'm using a intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); when launching the B activity but this way the onNewIntent is called instead of start a new instance 回答1: Use android:noHistory=true in manifest file for particular activity to clear.Hope this might solve your issue.

Activity doesn't show in full screen

微笑、不失礼 提交于 2019-12-30 12:14:08
问题 I defined a new Activity on my project and I have some trouble with fullScreen. I defined in the manifest file like this: <activity android:name=".Test" android:launchMode="singleInstance" android:screenOrientation="portrait" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" ............. > If I start the activity from another activity, I got the desired full screen. The problem is when I start this activity from a BroadcastReceiver - I need to open this activity inside a