I have the following code in which information about images is loaded with DB and shown in custom gallery view. The problem is that I can not see any way to set the setting on the OnItemClickListener for the gallery in AsyncTask's background thread because it is part of the main UI thread (I think?). The dialog pops up when I load the activity, but the freeze occurs and I think this is because I am setting up OnItemClickListener in the UI thread which is doing a lot of work. How can I solve this problem?
Private class loadsets AsyncTask & lt; String, integer, string & gt; {Progressive dialogue dialog = new progressivity (ActivityGallery.this); Prerequisite (@) {b = getIntent () on @ Override Protected Zero GetExtras (); Dialog.setMessage ("Loading ..."); Dialog.show (); } @ Override protected string doInBackground (string ... parameter) {log. V ("SC", "ASINNC goes here !!"); DB Handler Handler = New DBHDML (activity gallery). SQLiteDatabase DB = Handler .get Reddal database (); Cursor c = db.rawQuery ("select from pictures", blank); If (c.moveToFirst ()) {do {paths.add (c.getString (1)); Logs. V ("SC", "Cursor:" + c.getString (1)); } While (c.moveToNext ()); } C. Close (); Db.close (); Handler.close (); Return tap; } @ Override Preserve Update on Zero (Integer ... S) {} @Override Secure Zero at PostXextech (String Results) {Log. V ("SC", "Last Path:" + Path .ststring ()); SetContentView (R.layout.gallery); Find Gallery = (Gallery) VVBIID (RID Greleyer 1); Gallery.setAdapter (New ImageAdapter (ActivityGallery.this)); Gallery.setOnItemClickListener (New OnItemClickListener) {public void onItemClick (AdapterView & lt ;? & gt; parent, visual v, integer position, long ID) {selected_image_position = position; GoToShareActivity ();}}); Dialog.dismiss (); }} I think that GoToShareActivity () causes cold. See that function in detail.
Comments
Post a Comment