Please go through API demos In that progress bar examples are give and really help full
Thank you On Wed, May 13, 2009 at 12:20 PM, sheik <sheik...@gmail.com> wrote: > > Thanks...the above refrence and sample code really helped in > understanding threads and UI in android... > > Now i am looking for progress bar examples whr i can add it and make > it enable wen i am sending data to the internet.. > > Kindly suggest on it... > > > regards, > sheik > > On May 11, 5:19 pm, dillirao malipeddi <dillir...@arijasoft.com> > wrote: > > bellow code will connect to the url specified in the > > start_Download_Content(" url to connect"); > > > > and prints the response. may be this will help you > > > > and also set timeout as 10 sec > > > > import java.io.File; > > import java.io.FileOutputStream; > > import java.io.IOException; > > > > import org.apache.http.client.HttpClient; > > import org.apache.http.client.ResponseHandler; > > import org.apache.http.client.methods.HttpGet; > > import org.apache.http.impl.client.BasicResponseHandler; > > import org.apache.http.impl.client.DefaultHttpClient; > > import org.apache.http.params.BasicHttpParams; > > import org.apache.http.params.HttpConnectionParams; > > import org.apache.http.params.HttpParams; > > > > import android.app.Activity; > > import android.os.Bundle; > > import android.util.Log; > > > > public class download extends Activity { > > /** Called when the activity is first created. */ > > @Override > > public void onCreate(Bundle savedInstanceState) > > { > > super.onCreate(savedInstanceState); > > setContentView(R.layout.main); > > > > startDownload(); > > } > > /* > > static final String talam_vedike_chotu = " > http://www.arijasoft.com/customer_demos/Arija_Android_Dev/sdk/aor/cho... > > ?"; > > String okato_argument = "testnuller"; > > String rendo_argument = "null"; > > String aakari_padasmooham = talam_vedike_chotu + "mana_thalam=" + > > okato_argument + "&vadi_thalam=" + rendo_argument ; > > String sodhana_falitham = new String(""); > > */ > > private void startDownload() > > { > > // TODO Auto-generated method stub > > Runnable downloader = new Runnable() > > { > > @Override > > public void run() > > { > > // TODO Auto-generated method stub > > start_Download_Content("http://........................your > > connection................"); > > } > > }; > > new Thread(downloader).start(); > > } > > > > public String start_Download_Content(String url_Pls)//throws Exception > > { > > > > int TIMEOUT_MILLISEC = 10000; //=10sec > > HttpParams my_httpParams = new BasicHttpParams();; > > HttpConnectionParams.setConnectionTimeout(my_httpParams, > > TIMEOUT_MILLISEC); //set connection time out > > HttpConnectionParams.setSoTimeout(my_httpParams, > TIMEOUT_MILLISEC); > > // set socket time out > > HttpClient httpclient = new DefaultHttpClient(my_httpParams); > //get > > http client with given params > > String responseBody = null; > > > > try > > { > > > > HttpGet httpget = new HttpGet(url_Pls); > > > > Log.i("PLS CONTENT GET","executing request " + httpget.getURI()); > > > > // Create a response handler > > ResponseHandler<String> responseHandler = new > > BasicResponseHandler(); > > > > responseBody = httpclient.execute(httpget, responseHandler); > > } > > catch(Exception e) > > { > > Log.i("Exception","Http Connection"+e.toString()); > > } > > > > String _Content = responseBody; > > > > Log.i("","-------------START---------------------------"); > > Log.i("Response",""+_Content); > > Log.i("","---------------END-------------------------"); > > > > return pls_Content; > > > > } > > } > > > > > > > > On Mon, May 11, 2009 at 5:23 PM, sheik <sheik...@gmail.com> wrote: > > > > > Hi.. > > > i am facing similar problem..as i am using network connection in the > > > main thread....can u fwd any code regarding creating thread inorder to > > > send the request...and thus avoiding force close error... > > > > > kindly help in this regard.. > > > > > thanking you..in advance.. > > > > > regards, > > > Sheik; > > > > > On Mar 13, 4:40 pm, dillirao malipeddi <dillir...@arijasoft.com> > > > wrote: > > > > don't do any complex operations like network connection.. etc on main > > > thread > > > > for those operations use separate thread > > > > > > if any time taken operations on main thread will cause fource close > > > > exception > > > > > > try to keep main thread as simple as possible.. > > > > > > On Fri, Mar 13, 2009 at 5:05 PM, zeeshan <genx...@gmail.com> wrote: > > > > > > > Hi Android Experts, > > > > > > > i am having a force close Dialogue msg for few seconds when i run > my > > > > > application. > > > > > can anyone tell me why is that and how can i resolve it. > > > > > do i need to use thread to start my main activity? > > > > > > > any solution? > > > > > > -- > > > > Dilli Rao. M > > > > -- > > Dilli Rao. M > > > -- Dilli Rao. M --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---