Android :: How To Do A WebView / ListView In Same Activity OnCreate?

Feb 10, 2010

As you can see, I first create a webview. Then, I want it to immediately disappear. Then, I want the Listview to come up. But the problem is, I can't do Listview if I don't do ListActivity but then I can't do Activity. Code...

Android :: How to do a WebView / ListView in same Activity onCreate?


Android : Webview - OnCreate Always Get Called When Activity Comes To Foreground

Mar 29, 2009

I launch my TestWebView activity. After my web page is loaded, I put the app in the background by pressing the Home key. Then I bring the TestWebActivity back to the foreground. Unexpectedly, TestWebView's onCreate() is called when I bring the activity to the foreground. But onDestroy is never called. This same thing happens every time I tested. It appears the old TestWebView was not completely killed so there are possibly duplicate web clients running.

My code: .....

View 7 Replies View Related

Android :: Create A WebView Object In The OnCreate Function

Apr 18, 2010

I create a WebView object in the OnCreate function. Now I need to be able to pass this same object to other functions in the code, such as the onOptionsItemSelected function. I currently have it where I just create a new WebView object in each function where I need it, but this slows down the code since it has to recreate it and such.

View 1 Replies View Related

Android :: ListView SetAdapter In OnCreate - GetChildCount Is Zero In OnStart?

Oct 7, 2009

I want to display a ListView with checkboxes, and I want some of the checkboxes pre-selected. The ListView has setAdapter called during onCreate, and the list information appears when the screen is drawn. However, when I attempt to set certain list items as checked, my ListView reports getChildCount() = 0.

My SharedPreferences contains a list of sounds that have been previously selected, as a comma delimited string of list indices. Because the list appears to have no children in onStart, my attempts to set items as checked fails.

On the good side, once the list is rendered, I can select entries and hit Back, and my selection is stored to SharedPreferences correctly.

How can I load my previous selection into the list? Should I be using something else here?

In the spirit of open source. here's my code:

CODE:.................................

View 12 Replies View Related

Android :: Closing An Activity On OnCreate

Nov 11, 2010

I'm opening an Activity using this:

startActivity(new Intent(Parent.this, Child.class)); And on the child, I have this code on the onCreate function (the if contains more than just true, of course): public void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState); if (true) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setPositiveButton("OK", null); builder.setTitle("Error"); builder.setMessage("Connection error, please try later.") .show(); finishActivity(0); return;}}

Why is the activity not closing? I get the alert box, but then I have to tap the "back" button to go back.

View 2 Replies View Related

Android :: Activity Constructor Vs OnCreate

Jul 21, 2010

I understand that Android Activities have specific lifecycles and that onCreate should be overridden and used for initialization, but what exactly happens in the constructor? Are there any cases when you could/should override the Activity constructor as well, or should you never touch it?

I'm assuming that the constructor should never be used because references to Activities aren't cleaned up entirely (thus hampering the garbage collector) and that onDestroy is there for that purpose. Is this correct?

View 2 Replies View Related

Android :: Database Activity OnCreate()c

Nov 19, 2010

I know that network activity and expensive operations should not be done on the ui thread, but what about database activity?

I have an activity that, when started, I query an sqlite database and dynamically populate rows in a tablelayout with an inflator. I do this all in the oncreate() method. Should this be done in a separate thread?

View 2 Replies View Related

Android :: Oncreate - Intent Launches My Activity

Sep 30, 2010

Android will call onCreate() of my activity whenever it is launched.

In the onCreate() of my activity can I tell what intent launches my activity?

View 1 Replies View Related

Android :: Parent And Child Activity OnCreate?

Jul 2, 2010

I have a parent activity, and a child activity that extends the parent activity. When the parent starts the child activity,

Which onCreate gets executed first? The child's or parent's?

There is a particular variable I am setting in the Child activity's onCreate method, and right now, it looks like it takes a while to get to the Child activity's onCreate, and so the methods in the Parent are reporting an empty variable. Whereas when I make the Parent sleep for a while, it reports the correct variable.

CODE:............

So, basically, even after the Parent starts the Child, it still returns "Parent Value", but when I have the thread sleep, it return "Child Value".

View 1 Replies View Related

Android :: Opening A Context Menu In OnCreate Of An Activity

Aug 9, 2010

I have a need to capture some user input when an activity opens for the first time. I'm hoping to give the user a list of options to select from, which will be pulled in dynamically. I'll then store the selected value locally for future use. I'm not finding a way to do what I'm after and was wondering if anyone has run into this before and how they solved it.

Fantasy Football<http://chriswstewart.com/android-applications/fantasy-football/>- Android app for fantasy football fanatics and MFL owners Social Updater<http://chriswstewart.com/android-applications/social-updater/>- An easy way to send your status blast to multiple social networks

View 9 Replies View Related

Android :: ExpandableListView - Exception In The OnCreate Method Of An Activity

Mar 3, 2010

I am encountering an exception in the onCreate method of an activity.

CODE:.......

The onCreate method is as below.

CODE:......

The layout view XML is as below.

CODE:..........

I've already changed the ID of the ExpandableListView to "list". But it is not effective.

View 4 Replies View Related

Android :: Can't Call Service Function In Activity's OnStart / OnCreate?

Sep 28, 2009

My activity bind a service. I want to call the service's function in activity's onStart/onCreate function, but it doesn't work. The service started sunless but the connection is null. When I just call the service's function in other function (onClick for example),

View 4 Replies View Related

Android :: Parent Activity Runs OnCreate Before OnActivityResult Is Called - Sometimes

Aug 5, 2010

The order is:

A: startActivityForResult( B ) B: <dostuff>, call finish() A: onCreate <---- what's this all about A: onActivityResult

This happens for a tiny minority of users. I havn't been able to reproduce or find any common elements. A is the launch activity.

CODE:..............

View 7 Replies View Related

Android :: Activity Execute OnDestroy() / OnCreate() Method When Push On Keyboard

May 2, 2009

I use sdk 1.5 version and same to my handphone, my handphone is use G1. Now i test my application on my handphone. When i push on keyboard, i found system will destroy current activity(execute onDestroy() method) and execute onCreate() method again. So i will all current status and all datas. I don't wish this happen, how to block system execute onDestroy() and onCreate() when i open and close keyboard?

View 2 Replies View Related

Android :: Check Condition Inside OnCreate() Of Activity And Display An AlertDialog?

Aug 18, 2010

I am new to Android and this is my first question here so please go easy on me.

Is it possible to check some condition inside onCreate() of an Activity and display an AlertDialog?

I am creating an AlertDialog anonymously in Oncreate() and calling show on that instance but the AlertDialog is never displayed.

View 1 Replies View Related

Android :: Voice Recognition Activity Called In OnCreate Method / Causes App To Load Slowly

Oct 1, 2010

In my android app I call the voice recognition in my onCreate method of my startup activity. I have made it a preference to start up with the voice control or not. However, the app takes about 5-7 seconds to load when voice recognition is on. When it is off, the app starts almost instantly. Below is sample code, I have added Free_Form, max_results 1, and a custom prompt to mine.Why would calling the normal android speech recognition take sooo long to load in my OnCreate method?

View 1 Replies View Related

Android :: WebView In ListView?

Jul 22, 2010

I've implemented a list with each item as a WebView. The WebViews are loaded in their own threads so the UI doesn't have to wait.

The problem I've ran into is after the list is loaded, some webview items disappears or repeat after the list is scrolled. I've read posts from Romain Guy and others about how this is a bad idea. Just wondering if it's still a bad idea or a solution has been found since Cupcake.

View 5 Replies View Related

Android :: ListView Where Each Row Is Composed (mostly) Of A WebView

Oct 20, 2010

I think this has been asked elsewhere (StackOverflow) but with no satisfactory answer.

I have a ListView where each row is composed (mostly) of a WebView.

The "problem" is that you can't touch the WebView and fire the onListItemClick method of ListActivity.

I've tried to set android:clickable="false" in the xml file, but this also doesn't allow me to "click" on the WebView.

From another thread (http://groups.google.com/group/android-developers/ browse_thread/thread/684162fdf5a073ec), I've seen others state that putting a WebView in a ListView is "bad form" (e.g., "I don't see a situation where a WebView cannot be replaced by a text view or a combination of other compoenents [sic]. I still think this is a bad idea."),

Given this opinion, I think I should explain my "situation".

Each row in the ListView will contain a question whose contents vary.

The contents of the row will require formatted text (bold, italics, superscript, subscript, etc.) and 1 or more images. To me, this seems like an ideal situation for a WebView, because I don't know ahead of time what the specific order and structure of the text images will be.

So....I guess I have a few questions.

Is it possible to allow users to "click" on a WebView placed in a ListView and fire onListItemClick? If so, how? Given my needs, is there another way to structure my ListView rows without using a WebView? If so, what is it?

View 2 Replies View Related

Android :: From WebView In Droid Back To A ListView?

Jul 29, 2010

After a successful web view is loaded, now after some processing on the HTML page, I would like to return the control to the main screen. Is this possible in Android?

The control after the webview is launched, is in the browser, so after I make some ajax calls and then get a positive server side message. I would like the control goback to my Webview Activity.

View 2 Replies View Related

Android :: Selected State Of WebView In A ListView Does Not Show Selection

Feb 3, 2009

Is there a way to show that a WebView item contained as a item in a ListView is selected? Right now the WebView does not seem to display its contents transparently like every other control so it takes up the entire view and does not show its state as selected.

Also, when the content of the WebView is selected, scrolling down with the track back does not seem to cause the WebView to loose focus. If I continue to scroll down with the track ball, all of a sudden an item in the middle of the ListView gets selected.

View 3 Replies View Related

Android :: Fom Webview To Activity

Feb 23, 2010

is it possible that a user clicks inside a webview on a link like <a href/> and then my activity is opened? I need this for sms, email, telephone and some specials. Lets say the user browses on the impressum and clicks on the phone number for support. I want the phone to call that number.Or lets say the browser clicks on an image (with a special href?), and I want the user to land on my picture-view-activity.

View 3 Replies View Related

Android :: Keep Webview In One Activity?

Jan 10, 2010

Does some please let me know how to use webview? I want to make a webview keep to work wthin in a layout without opening new web browser when clicking a link tag.

For instance, you can see the "Hello" text and google web page on a display. Then if you click the "help" or "news" or "settings" links, the android boots new web window and shows the web page.

I want to keep/fix the webview to open web page. I dont want to start android embedded web browser.

CODE:....................

View 3 Replies View Related

Android :: Back To Activity After WebView?

Nov 14, 2009

I've been searching and looking for this answer for quite some time now. I want to display a little HTML in a webView.

When the User read the HTML, he's supposed to use the back button to go back to the previous activity. However, it closes the App.

How can I make it go back to the last Activity? It would also be ok to display a soft back button or something. Here my code...

View 2 Replies View Related

Android :: Scrolling My Activity Including WebView

Nov 12, 2010

I included a WebView in my activity and load some Javascript in it which is then going to get data from an external website.This works and displays fine but the problem is that my activity doesn't scroll when the WebView is done loading so I can't see the bottom of the WebView such as all the other Views I put below this.

View 2 Replies View Related

Android :: Can I Disable Webview On Click Activity

Jul 14, 2010

can i disable the webview onClick Activity(); I have a couple of webviews in a listactivity and i want to capture the listclick instead.

View 3 Replies View Related

Android :: Activity Timeout On WebView Load

Aug 3, 2009

In my app I have to load external page into WebView-based activity. Some of my users with slower connections are reporting screen timeout while waiting for the page to load. What would be a good way of loading the page on backgorund thread and then refreshing the screen? Use HttpClient to fetch it and then use WebView#loadData? My fear is - the page I'm loading is pretty complicated there's some JS that happens on load - wouldn't I just mess it up? Is there an alternative way of doing what I need?

View 5 Replies View Related

Android :: Pause Flash Content In WebView When Activity Isn't Visible?

Aug 7, 2010

I am experimenting with using a WebView to display Flash content inside my activity. Everything is working pretty well, but when the user hits the home key to put the activity into the background, the Flash content keeps running (sound keeps playing, etc)

I have noticed that both the stock Android browser and Dolphin Browser seem to avoid this problem, and properly pause the Flash content when the browsing activity is put into the background.

Ideally I would like a solution that kills the WebView completely if the activity is finishing, but pauses it otherwise (basically copying the default behavior of the browser)

Here is a simple test I put together that loads a game on Kongregate which has some background music:

CODE:..............

I took a look at the latest source for the stock browser, and it seems to be doing something similar (calling pauseTimers/resumeTimers), although I fear the code I have been looking at is out of date, because it is calling functions that don't seem to exist anymore.

I did verify that the call to pauseTimers is working by testing with a simple JavaScript setInterval which updates a counter. Is there something else obvious that I should be trying in regard to Window or View management?

The documentation for the mobile Flash player says:


Flash Player will also automatically pause SWF playback it is not in view or the foreground application, for example when a call is received or alarm goes off, to reduce CPU utilization, battery usage and memory usage.


This seems to be working perfectly in both the stock browser and Dolphin Browser, but not in my app. Any ideas/solutions would be greatly appreciated!

Update: Here is the function we ended up adding to our activity to get this to work. We call it with "onPause" in the activity's onPause function and "onResume" in the activity's onResume function:

CODE:....................

View 2 Replies View Related

Android :: Retrieve User-Agent Programatically Without Having A WebView In Activity?

Sep 2, 2010

Is there a way to retrieve Browser's user-agent without having a WebView in activity?

I know it is possible to get it via WebView:

WebView view = (WebView) findViewById(R.id.someview);
String ua = view.getSettings().getUserAgentString() ;

But in my case I don't have/need a webview object and I don't want to create it just for retrieving user-agent string.

View 1 Replies View Related

Android :: How To Show A Webview Inside An Activity In Middle Of Screen

Jul 30, 2010

I am having issue while showing a WebView in an activity in the middle of the screen. I have an activity and I want to show a webview in the center of screen. My activity is transparent so background activity will be visible. Whenever I try to create a webview and add it to activity using setContentView(webview) it always shows the view on the top left corner of the screen. Is their a way to workaround this?I am trying to do this via pure code only.

Here is my code.

CODE:....................

View 1 Replies View Related

Android : WebView - Not Able To Go Back To My Activity Screen Once The Content Is Displayed

Apr 9, 2009

Step 1: I am subclassing WebView and rendering html content properly. The intial content is very small with a div and image /link This is displayed in a LInear Layout along with a TextView and ListView. That is my first screen/activity of the application.

Step 2: When I click on a link on this webview, it goes through the webViewclient and expands to full screen to fit the content of the requested page.

After Step 2, I am not able to go back to my activity screen once the content is displayed. When I click on the back button to getback to my activity screen close my activity and goes to the phone's applications desktop. (i.e goes out of my application).

Step 3: In order to fix this issue, I stopped setting my own subclasssed WebViewClient. After doing this, the it seems to render the clicked page in a webView as subactivity. Now When I click on backbutton, it goes back to the activity screen. But, the issue now is, I am not catch event when a link is clicked. How can I catch click events in this case.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved