Android :: View Containing Reference To Its Activity
Oct 28, 2009
I have a custom view that needs a reference to the activity that created it.Dianne Hackborn said in another thread: >Give your view a reference to the activity (or a Java interface it implements) and call back through that. >Much much MUCH more efficient than sending a broadcast. >See all of the standard view and view subclass callbacks for examples.
View 9 Replies
Jul 20, 2010
I want to have a class "Utils", that will have several methods used all over my code. For example, I have a top bar with a textview and two ImageButtons that must display different texts and icons on different activities.I created the class Util, but it doesn't extend Activity. The problem is that if it doesn't, findViewById isn't there, can't find stuff etc.
View 1 Replies
View Related
Dec 3, 2009
instead of referring the custom widget by a fully qualified class name, is it possible to map with a shorter name. Like it happens in ant custom tasks (though properties file).
View 4 Replies
View Related
Jun 17, 2010
Would it be there noticeable speed improvement if I would create local references to needed view elements (e.g. EditText or Button) in my activity (in onCreate()) and use them for accessing needed elements or it does not much matter if I always use findViewById() when I need to access some particular element?
View 2 Replies
View Related
Oct 30, 2010
So say there's an app running (any app). I'd like to be able to get it's Activity from within a Service that will be triggered to run from a android.intent.action.SEARCH_LONG_PRESS.
Is this possible?
View 1 Replies
View Related
Mar 9, 2009
I want to pass a class reference to an activity, and then the activity will construct the view according to the content of the class.
How could I implement this function?
View 3 Replies
View Related
Jul 24, 2010
I have an AsyncTask that scans the file system and publishes progress through Notifications. To do this I need a reference to the current Activity in the AsyncTask.
I also don't want to kill the task when the activity is destroyed. How do I avoid leaking the activity and everything it references on each configuration change?
One possibility is to remove the reference in OnPause() to be sure it is gone when the Activity is destroyed, but that would mean notifications stops coming as soon as you leave the activity which is no good.
Isn't there a recommended way of dealing with AsyncTasks in this way?
View 12 Replies
View Related
Oct 4, 2010
I currently have a tab layout with 2 tabs, one tab with a list view and one with the option make strings so I can add them in the list view. Both tabs have their own activity because this made the code much more structured, and I dont have to repeat my self later.
Lets say im in the tab that offer me to create an string, and i press the update list button, how do I update the list view without startActivity()? If i use startActivity(), it starts List.java, and instead of displaying the list in the list view tab, it takes full screen, which defies the purpose of the tab view. In other words, the startActivity() steals the focus from the tab view of the list, and sends it fulscreen.
I want to update the activity in my list view tab, without starting a new activity that goes to fullscreen, and doesnt update the one in the tab.
View 2 Replies
View Related
Nov 11, 2010
I want to show my next activity withing my previous activity layout "LinearLyout". But it is not working. Can any one help? I put my last activity layout reference to a global class in an static variable. My code...
View 3 Replies
View Related
May 15, 2010
I have ListViewActivity
public class SelectActivity extends ListActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.select_one_of);
SimpleAdapter adapter = new SimpleAdapter(
this,
createChildList(),
R.layout.select_one_of_childrow,
new String[] { KEY_VALUE },
new int[] { R.id.selectoneof_add_new_item});
setListAdapter(adapter);
}
// ...
}
after setListAdapter() calls I would like to execute the following code:
((TextView) getListView().getChildAt(0).findViewById(R.id.selectoneof_add_new_item)).setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.ticked, 0); but getListView().getChildAt(xxx) returns null and I catch NullPointerException. Where should I put mentioned above code-snippet?
View 1 Replies
View Related
Dec 24, 2012
I am working on developing an app and I am not sure when should I use a new activity and when should I update the existing view.
For example, lets say I have a view that shows a multiple choice question.Now, when the user selects his choices and clicks on say "Evaluate", I want to show the same question view but along with the right answers and explanations for each option. So does that mean, I should send an Intent upon a click on Evaluate or I should just update the view (i am not sure how)?
If I send an intent and show a new screen, how can the user go back to the next question without displaying the answers? If I don't create an new activity, how can I update the existing view that is already displayed?
View 4 Replies
View Related
Oct 2, 2010
How to open activity from view.i am develop a game if game is over i need to move user to main menu activity.Please help me its very urgent to me.
View 2 Replies
View Related
Jun 2, 2010
I want to have a view with several choices when I click an element of my ListView. I was thinking of implementing an AlertDialog but as I need more than 3 options it is not possible. I also thought of putting my ListView in a FrameLayout and have an view with a gone visibility that I would turn visible at the click and update the content but I don't know If it's a good idea. Code...
View 3 Replies
View Related
Jun 20, 2010
You've got a View defined in a layout file. How do you remove it from you Activity code?
View 1 Replies
View Related
Nov 4, 2010
I want to start a new activity intent in my current view! How i can do that?
View 3 Replies
View Related
Jul 13, 2010
It occur some problems to develop U/I. there is a PreferenceActivity that was aleady developped and is typecally like 'Settings' of android. by the way, the customer is requiring to change U/I like IPhone.Requirements are
1.application title-bar using ImageView(or TextView) positions to top
2. remove ContextMenu, alternativly static menu buttons positon to bottom.
3. PreferenceActivity is able to scroll and title-bar & menu buttons are fixed each positions.
just all. but It's very difficult to add & fix two views in Preference Activity.
View 3 Replies
View Related
Mar 14, 2010
I just started developing a simple Android application while I'm still learning its platform. I'm using Eclipse IDE with the ADT plugin 0.9.6 and I need to know if it's possible to view the activity stack that is associated with a Task. Is there any way through the DDMS tool or through any other technique?
View 4 Replies
View Related
Jul 28, 2010
Everywhere I look online, it seems that I must use an animation to change views dynamically (like slide in, out). Do I have to do this, or can I simple just setContentView() on each new activity?
View 1 Replies
View Related
Jun 30, 2010
I want to show the details of a list item in another activity when clicks on a button.Can you help me?
View 2 Replies
View Related
Aug 15, 2010
I am trying to make an Accordian control where each section would have its own view accompanied with its own activity. With the TabHost I can add tabs based on Intents and it is this behavior I am trying to understand how to use. So given an intent or an activity how can i get the view?
View 1 Replies
View Related
Oct 10, 2010
This is a followup to this post: http://stackoverflow.com/questions/3897176/findviewbyid-in-a-subclassed-surfaceview-throwing-runtimeexception Based on Romain Guy's feedback (which I'll accept shortly as it is a solution), I'd like to obtain the calling Activity from within the View, so that I can use it to obtain the desired Text View resource. I don't see any methods in View that return Activity. What is the proper way to do this? Or is there a better alternative for working with TextViews from within another View context. Basically, I am calling setContentView(R.layout.xxx) in onCreate() (as usual), so I don't really have a way to pass in references to additional TextViews unless I awkwardly retrieve the View after setContentView and then make calls on it.
View 1 Replies
View Related
Jun 11, 2009
Is there a function that allows me to get the top most view (the root)?
View 2 Replies
View Related
Feb 4, 2010
It displays the first view correctly but i want it to be connected to a java class so i created an FirstActivity class where i can control all my components in the first view but how do i attach the first.xml layout with the FirstActivity java class ?
View 1 Replies
View Related
Jun 18, 2010
Is there a way to start an activity from a view? I have this nice view that renders these menu buttons and when they click a particular button (Trapped in an onTouch event) I want to start the "clicked" activity. It seems that there from my view startActivity method is uncallable. So that leads me to believe that there is no way to do this, in which case I guess I am asking, what do I do here when I want this menu to have a view that animates drawables and can get touches to know what "button" was pressed to know what activity to start?
View 2 Replies
View Related
Jun 1, 2010
I want to write an application to List the Gmail message. In the list, if user click one of the message item, it shall link out Gmail App to see more detail information. Currently I can read the Gmail db with Gmail.java. There are some problems while I want to open Gmail Activity. In general, we can open Activity with Action and parameters. But Gmail App has not release code base. We do not know what Action set to Gmail Activity and what parameter shall we put the extras. I only know that the Activity of View detail Message is named "HtmlConversationActivity." And the Package is under "com.google.android.gm.
View 1 Replies
View Related
Feb 11, 2010
now i dont know which event to implement to handle checkboxes in list when i click on checkbox it expands the list.... how to distinguish list click with checkbox placed in expandable list? or kindly refer me to tutorial same as expandablelist view with checkboxes.
View 1 Replies
View Related
Nov 24, 2010
I have a problem with my app, it haves a lot of activitys, two of them haves googlemap views. My A activity haves a full mapview and my B activity haves a small map view. OK, when i am on the B activity and press back key somethimes until i return to my A activity, the map of my A activity shows with errors, with a black zone in the down part of the window. THis only happens when i press back from the B activity. Code...
View 1 Replies
View Related
Aug 6, 2010
I'm working with a list view trying to get specific activities to open when a certain item is selected. This is the code that I'm working with right now. I know its wrong but am not sure what I need to change it make it work. I think I need an intent and tried a few ideas but did not come up with much.
CODE:............
View 1 Replies
View Related
Apr 19, 2009
Is it possible to add a view dynamically that overlaps other views in the layout. I have Linear Layout defined for the activity. As part of the Layout I have a custom View. The content changes dynamically and sizes appropriately based on the content size, with fill_parent for width and wrap_content for height. But what I want is, dynamically take over the full screen and then based on a click go back to the normal mode. Is there a mode to display a view where - in it can overlap all other views in the layout?
View 3 Replies
View Related
Feb 19, 2010
I want to do some data processing (in a thread) right after my main Activity starts. For that data processing to be started I also need to know a visible size of my main View (which is a LinearLayout currently, but whatever).I wonder how to do that. I.e. I wonder what is the entry point (callback?) I should use to be sure that my main View has been layed out, so i can use view.getWidth/getHeight? Is creating a custom View and reimplementing it's onSizeChanged() - the only way? In this case how should I properly describe it in my xml layout file? (it will contain some child views)
View 1 Replies
View Related