activity

How to access an element present in parent view?

full code how do i access the parent activity's mail layout elements? In this case a button. I have it declared in main.xml. When a button in the listview is clicked, i want to change the text of the button in main. ...

How can I end an activity from inside a SurfaceView class or nested thread.

I’m writing an application (game) where I would like to end the game activity when the user fails the game. My game is loosely based off lunarlander, so I figure it may be easier to ask for help using lunarlander as an example, since a lot of folks are familiar with it. When the user fails the lunarlander game, I want to automatically ...

How does Android's Activity lifecycles work in relation to the entire Application?

This doesn't appear to be well documented or I missed it, so before I run a bunch of my own tests I was wondering if anyone already knows the answers to some of these questions. First off, when I say "Application" I am referring to extending the Application class. http://developer.android.com/reference/android/app/Application.html The...

[Android] : How much time can be taken inside onDestory() before the activity is killed?

Hi, I know my question caption must have sounded really vague. But let me clear it out here. Say I have an android application over a middleware stack. In onCreate() of my activity, I initialise my middleware modules. In its onDestroy(), I must de-initialise the middleware. Now my middleware calls may take quite some time to process....

Need to make button on widget open external activity.

I can't seem to find a simple example of how to make a button that is on a widget launch an external activity. I'm well aware of how to do this with a button in a normal activity. But it seems that things are a little different when down through a widget. I'm trying to make a button on my widget open up the official Facebook App. From w...

android: Can i use different class for different child of viewflipper

Hi, I have different screen to work in an android application. I'm using ViewFlipper for this. I decided to used different class for different view children public main extends Activity{ { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sign_in); ViewFlipper viewFlipper ...

Open only one activity, without the main activity

I have an application that has one service and 2 activities.One activity (the main one) is a preferences activity and the other one is a dialog themed activity. The service from time to time needs to open only the dialog themed activity (using FLAG_ACTIVITY_NEW_TASK). The problem is that when the preferences activity is opened in backgro...

Android proper use of setId()?

I have a series of activities that share a database. In the primary activity the user will be doing things will the program automatically logs data into the db. This continues until the user would like to view the database by starting the view database activity. How I have it set up is that onPause will close the database so the the DBVi...

How to prevent saving browser pages in activity stack history

User click one button on Activity#1 to start Activity#2. One button on Activity#2 start system default browser(Intent.ACTION_VIEW) to get Twitter authorized. After user allow, Twitter redirect user to Activity#2(Custom intent-filter+data) and it save the tokens. Now, if I press back key, the app back to browser, how to prevent this a...

How to save the instancestate of my activity

I obviously new and have been trying to two days to figure out how to save the state of my main activity to no avail. I would appreciate any help. When I launch the ShowDetail activity and return to the main activity I have no data in the list. I have two xml files a main.xml and a item.xml file. main is just a listview and a textview. I...

Implementing the "Go to Home" functionality in Android?

Hello friends, I want to implement a Home button in my Android App which will terminate the all the Activities but the first one. Instead of user pressing the Back button again and again, I want to give user a single button which will take him/her on the first (Home) Activity. Please help how to implement it. ...

onActivityResult Does not works in android

hello guys, i have a main Activity called Main which has onActivityResult Method. protected void onActivityResult(int requestCode, int resultCode, Intent data, Bundle extras) { Log.i("in OnActivityResult", "in OnActivityResult"); super.onActivityResult(requestCode, resultCode, data); Log.i("in OnActivityResult", "in ...

killing activity on Android doesn't clear memory??

I have a game running on android. basically, it's structure is like lunarlander I started my activity , using the layout to start the class running. <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> ...

How to clear a notification if activity crashes?

In my app, I'm creating a notification with the FLAG_ONGOING_EVENT flag set as such.. Notification notification = new Notification(iconId, text, System.currentTimeMillis()); notification.flags |= Notification.FLAG_ONGOING_EVENT; I'm cancelling the notification in onDestroy, but if my app crashes before calling onDestroy, is there an...

How to keep FTP connection (or any connection object) alive between activities

Hey, I'm coding a very basic FTP client on top of my application and I have 2 activities. The first one is the file explorer and the second one is the image viewer. Once I click on the image filename on the explorer, I want to pass the connection to the other activity to handle extra stuff. Basically, I want to keep the same org.apache....

Calling the function "startActivity" in other class and file doesn't work

I want call the function startActivity in two ways: First (It works): public class HelloWorld extends Activity { public boolean onOptionsItemSelected(MenuItem item) { if(item.getItemId() == 1){ startActivity(new Intent(Intent.ACTION_DIAL,Uri.parse("tel:660718109"))); } ...

Android Library using Main Project Resources

I am not getting is this is right way to solve problem or not... Situation is... I am creating Library for Android project.. Activity is declared in the Library Project..As it will be reusable in different projects. Lets Name it ActivityA ActivityA is using images which are Project Specific.. I have added images in Main Project... I...

Is there anything I need to take into account when repeatedly calling the same activity?

I am developing an app where a single activity is instantiated multiple times by itself. I guess you could think of it like a book where each activity is a page. At the end of the page (activity) the user presses a button to go to a new page. I fire off an Intent for the same Activity, but I push different data into the Bundle so that...

Activity to Activity Communication

Hi All Activity a =AssumeSomeActivityExists(); Intent openActivity=new Intent(); openActivity.setAction(Intent.ACTION_VIEW); openActivity.setClass(a,B.class); a.startActivity(openActivity); When we do something like above how to make B instance know that it is been called and created by Activity a? Thanks & Regards Sudhakar Chavali ...

what method of main activity executes when application closes?

hello guys, Can anybody tell me what method of an activity executes when an application closes?. like i have a main activity and if i press back button on my phone. The Application closes so i want to know what method executes at that time. ...