activity

New Activity nullpointerexception Problem

Hello, I have a noob problem. Here is my situation: I want to start a new activity from the main activity. The code to launch the new activity is found in a separate class file. I seem to be passing the wrong arguments and I am ending up in a nullpointerexception when trying to launch the new activity. The new activity launches fine whe...

How to reopen a stack of Activities?

Hi, my App is Launched by "Main.java" (Activity) and opens a Notification and a second Activity called "Sub.java", now I press the Home-Button and the App disapears (everything okay until here). If I'll now click on the Notification the "Main.java"-Activity is launched, the "Sub.java" seems to be lost. Is there any posibility to reorder...

android startActivityForResult FLAG_ACTIVITY_NEW_TASK

Is there a way to use startActivityForResult() in conjunction with the FLAG_ACTIVITY_NEW_TASK flag? I have a dialog activity that i want to be started new each time, however when i pass in the FLAG_ACTIVITY_NEW_TASK flag, then the onActivityResult() method of the calling activity is not called when i return from the child activity (usin...

Android ActivityManager killBackgroundProcess not working

I am using eclipse. I am trying to kill a process in my application. However, in eclipse it does not seem to know the hint for killBackgroundProcess from the ActivityManager and it will not let me proceed. I read that you have to have permissions to kill background processes and already added the permission which it did not recognize eit...

Android - DatePicker widget problem

Hi, I am trying to create activity with few controls and a DatePicker widget. And I am facing one strange problem that I can not explain. If I set activity that has only DatePicker widget shown app works. And if I set activity that has other controls without DatePicker it works too. But when I show them both I get a NullPointer Excep...

How to pass an array of Address objects to an other Acitvity

Hi I'm trying to pass an array of Address objects to another Activity through an Intent object. As the Address class implements the Parcelable interface I try to do the following. I got a List Address object from a Geocoder object, which I convert into a array of Address objects. Then I put this array into the Intent and call the acti...

Get Value of a CheckBoxPreference in an Activity

Hi there, I've got a preferences.xml: <?xml version="1.0" encoding="utf-8"?> <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"&gt; <PreferenceCategory android:title="Category"> <CheckBoxPreference android:key = "inputPreferences" android:title = "Title" ...

Android: How to get background color of Activity in Java?

How can I get background color and text color (default for child views) of an Activity in Java? ...

How to BringtoFront the Parent Activity in Android?

As we know, startActivityForResult() used to get a result for a task from parent activity. Here when we click the setResult(). It returns the result to the parent Activity. Child Activity means it should maintain the persistent state. That is when the users clicks a button on the child activity. It do not finishes that activity and sho...

Android dialog management

Hi all! I'm developing an android app (if you want more info http://www.txty.mobi) and I am having some problems with dialogs management. I'm quite new to Android so the way I'm doing things completely wrong. If the case please just say so pointing me to the right documentation to follow. Background: The main blocks of the app so fa...

Displaying an android dialog out of application

I have an application that is designed to pop up a question when a phone call ends using a BroadcastReceiver and a PhoneStateListener. My problem is, when a call is received while the user is not currently using my application, the dialog is not displayed until the application is manually started. I would like either for the dialog to b...

How to handle Activities with different orientation?

I am having two activities in my app TestActivity (T1) and TestActivity2(T2). TestActivity is the launch activity which in turn starts TestActivity2. T1 has portrat orientation while T2 has landscape orientation (in the android manifest file). Now when T1 starts up and initiates T2, T1 gets destroyed and recreated again. Is there anyway ...

Shared preference

I developed one app in that i want to sen URI from Class1 editText to another class containing editText can anyone tell me how to do that ...

(in Android) Do Activity classes need to be in a separate .java file?

I am new to android development and am currently working my way through the "Hello..." Tutorials on the developer website. I got stuck on the Tab Layout walkthrough and the only way I could resolve it was to put each Activity Class in a separate .java file. I was wondering if all Activities need to be in separate .java files, or am I ...

Use of static finals in Android Activity.

Why is the use of static final variables encouraged to declare constants over just final variables? The use of static sounds logical when there will be many instances of a class but is this argument correct when used for a Android activity. In fact, since the Class instance will be around even after the activity finishes and is eventuall...

Theme.Dialog view size problems

I'm trying to create a basic AlertDialog using an activity with a theme of Theme.Dialog. However, I'm having an issue with the size of the dialog. My XML is currently this: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TableL...

Why is android restarting my activity when I call finish() on it?

I have an activity that after some user interaction calls finish() on itself. From time to time it gets into a loop where when it calls finish() it finishes but immediately restarts again. Any idea why android tries to restart my activity? ...

Android Activity check service to start another activity

Hi. I need to made an activity (without layout) that on start check if a service is running. if it is true it starts Activity2, if it false it starts Activity1. I tried with this code: public class FirstActivity extends Activity{ private final Intent serviceIntent = new Intent(ServiceConnected.class .getName())...

Initializing an Android application

Hi, I am currently facing the following problem: whenever my Android application is started, it needs to execute some time consuming initialization code. Without this code all my activities/services within the application won't work correctly. So far, I have put this initialization code into a SplashScreen activity, which I declared as...

WeakReference to Activity (Android)

In my Android app, when a user tries to transition from one activity to another, there may be some global state that indicates they need to complete some other action first. To accomplish this, I've written a class with the following code: private static WeakReference<Activity> oldActivityReference; private static Intent waitingIntent;...