Android “Only the original thread that created a view hierarchy can touch its views.”

You have to move the portion of the background task that updates the UI onto the main thread. There is a simple piece of code for this: runOnUiThread(new Runnable() { @Override public void run() { // Stuff that updates the UI } }); Documentation for Activity.runOnUiThread. Just nest this inside the method that is running … Read more

Fling gesture detection on grid layout

Thanks to Code Shogun, whose code I adapted to my situation. Let your activity implementOnClickListener as usual: public class SelectFilterActivity extends Activity implements OnClickListener { private static final int SWIPE_MIN_DISTANCE = 120; private static final int SWIPE_MAX_OFF_PATH = 250; private static final int SWIPE_THRESHOLD_VELOCITY = 200; private GestureDetector gestureDetector; View.OnTouchListener gestureListener; @Override protected void onCreate(Bundle … Read more

You need to use a Theme.AppCompat theme (or descendant) with this activity

The reason you are having this problem is because the activity you are trying to apply the dialog theme to is extending ActionBarActivity which requires the AppCompat theme to be applied. Update: Extending AppCompatActivity would also have this problem In this case, change the Java inheritance from ActionBarActivity to Activity and leave the dialog theme … Read more

findViewById in Fragment

Use getView() or the View parameter from implementing the onViewCreated method. It returns the root view for the fragment (the one returned by onCreateView() method). With this you can call findViewById(). @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { ImageView imageView = (ImageView) getView().findViewById(R.id.foo); // or (ImageView) view.findViewById(R.id.foo); As getView() works only after onCreateView(), … Read more

Is quitting an application frowned upon?

This will eventually get to your question, but I first want to address a number of issues you raise in your various comments to the various answers already given at the time of this writing. I have no intention of changing your mind — rather, these are here for others who come to read this … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)