activity

How to force main Acivity to wait for subactivity in Android?

hi, I am calling a subactivity from main activity. This subactivity should take few numbers from user (i'm using Edit text control to achieve this), save them to static variable in another class and terminate. I want main activity to wait for subactivity but both are just running simultaneously. Even doing sth like that doesn't help: ...

how to go on previous screen from current screen in Android app

How do I go to previous screen from current screen in Android app? I know there is a back button on phone, but it takes me to beginning screen of my app and I want my buttons on app to work for going back to previous screen. ...

[Android] How to keep TabHost at portrait orientation and listen for configChanges (orientation).

Hi guys, Could you advise how to keep TabHost with all tabs at portrait screen orientation and at the same time listen for configChanges = orientation? I am going to show another activity when orientation is changed. Seems to me configChanges (orientation) event does not fire when screenOrientation is set to portrait mode. Thanks for ...

Re-load Android activity data

Hi, I am writing an Android app, part of which will be a survey involving multiple pages of checkbox question and answers. I have created an activity to display the question and options (from the DB) and what I want to do now is when i press the "Next" button it should just reload the current activity with the next question set from the...

Best practice for viewflipper containing 10 linearlayouts?

I'm embarking on a GUI Activity composed of a viewflipper, which I would like to contain 10 linearlayout layouts. Is it advisable to put all of my layouts into the same XML resource/layout file? If not, is there a more organized approach to coding a viewflipper with many layouts? Will having everything in the same file come at a sig...

How to get right/left arrows on Activity to indicate more screens to the right/left?

I have a ViewFlipper which contains a few linear layouts. I need to allow the user to flip through them. I've seen other apps which have arrow/triangle indicators on either side of the screen, which, when pressed, flips to the next view in the set. I'd like to add these to my Activity. ...

Obtaining data from Android sensors without Listeners

I have following code: public class readSensorsData extends Activity implements SensorListener { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); sm = (SensorManager) getSystemService(SENSOR_SERVICE); } @Override public voi...

How to test a call to setContentView?

How do I write a unit test to determine that the layout used in setContentView(int layoutId) has been called and corresponds to the proper layout for a given activity? ...

Android: how do i pass an object from one activity to another

I need to be able to use one object in multiple activities within my app, and it needs to be the SAME object. What is the best way to do this? I have tried making the object "public static" so it can be accessed by other activities but for some reason this just isn't cutting it. Are there any other ways of doing this? ...

Android: How to make launcher always open the main activity instead of child activity? (or otherwise)

I have activities A and B. The A is the one with LAUNCHER intent-filter (i.e. the activity that is started when we click the app icon on home screen). A launches B using startActivity(new Intent(A.this, B.class)). When the user has the B activity open, and then put my application into the background, and later my application's process...

Error running helloworldtest from the tutorial

I'm getting the following error whenever I try to run a test. I have also tried to load some of the samples and test them, but I get the same error. This is generated following the tutorials found here Thanks for any help java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN flg=0x1000000...

Android Status Bar Notifications - Opening the correct activity when selecting a notification

I have been having a problem with a notification not opening/going to the correct activity when it has been clicked. My notification code (located in a class which extends Service): Context context = getApplicationContext(); CharSequence contentTitle = "Notification"; CharSequence contentText = "New Notification"; final ...

android: how do i open another app from my app?

I understand how to use intents and startActivity() when opening another activity within my own app, but how do you start a different app? specifically: -how do you determine if the user has the needed app installed on their device? -how do you start that app? -how do you pass parameters to that app? -how do you find all this info out ...

Using intent.getStringExtra from within an activity

I am relatively new to android. I have two applications A and B. I have an activity in A, lets name it x, that would launch the application B. Now the intent sent by x contains StringExtra that I want the Starting activity in B to use. Is there a way for the activity in B to do that? Thanks! ...

Starting an activity from Broadcast receiver in android

I am trying to launch the Main Activity from a broadcast receiver. Can anyone guide me as to how I can do it? I always get "Process is Bad" message. Thanks ...

Howto extend SomeActivity to relocate e.g. onCreateOptionsMenu?

Hi everyone, I know this should be fairly simple but I don't get it anyhow. I've got an Activity (let's call it XyActivity) which has gotten pretty long. Therefore, I'd like to relocate some overriden methods to a subclass (let's call it XyOptions). Looks like that: public class XyActivity extends Activity { XyOptions xyOptions; ...

Android TabHost: update tabs from tab's activity

I have a TabActivity and am going to have 3 or 4 tabs. In TabA, I would like to have an ExpandableListView, which will list products. I would like TabC to act as a sort of "shopping cart", probably with a ListView of itself. So, my question is: is there a way to interact with the TabHost from the Activity? I would like to be able to cl...

Android: access drawables outside an activity

How do access a drawable which resides in my project's res/drawable folder from outside an activity? The component which handles the loading of images is generic and is not inside any activity. I would like to display an image from res/drawable in case it can't be fetched from the web. Thanks, Rob ...

Problem passing Data within Activity

Intent intent = new Intent(this,AnotherClass.class); intent.putExtra("Name", "foo"); setResult(RESULT_OK, null); super.onActivityResult(requestCode, resultCode, data); switch (requestCode) { case (1): { TextView textView = (TextView) findViewById(R.id.TextView01); if (resultCode == Activity.RESULT_OK) { ...

Service and a BroadCastReceiver

Hi, I have seen several examples on how to implement a BroadCastReceiver, but how should I implement a Service who has to react on some pending Intent (for example incoming phone call)... Actually I was wondering about the same "prbolem" but in an Activity.. You obviously have a class which extends a Service 9or an Activity) so it cannot...