Skip to main content

Featured

Android studio “SDK tools directory is missing”

Following 2 possible solutions will resolve this problem :  Solution1 : To fix the problem, it was required that I list the path to my corporate PAC file by using  Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy . I selected "Automatic proxy configuration url:" Delete your  ~/.Android*  folders (losing all of your settings :/). Run Android Studio. It will show you a welcome wizard where it tries to download the SDK again (and fails due to my rubbish internet). Click the X on the wizard window. That will enable you to get to the normal welcome dialog. Go to Settings->Project Defaults->Project Structure and change the Android SDK location to the correct one. Solution 2 : To fix the problem, it was required that I list the path to my corporate PAC file by using  Configure -> "Appearance and Behavior" -> System Settings -> HTTP Proxy . I selected "Automatic proxy configuration url:&quo

Code to change background drawables for button(or)imageView(or) TextView clicked(or)touched,in android



TextView creditCardsBtn=(TextView)findViewById(R.id.creditCardsBtn);
LinearLayout  showCreditCardsbtnlayout=(LinearLayout)findViewById(R.id.showCreditCardsbtnlayout);
        showCreditCardsbtnlayout.setOnTouchListener(new View.OnTouchListener() {
            public boolean onTouch(View v, MotionEvent event) {
               
                if(event.getAction()==MotionEvent.ACTION_DOWN)
                    creditCardsBtn.setBackgroundResource(R.drawable.amex);
               
                if(event.getAction()==MotionEvent.ACTION_UP){
                    creditCardsBtn.setBackgroundResource(R.drawable.creditcard_btn);
                   
                    Intent intent=new Intent(HomeScreen.this,CreditCardListScreen.class);
                    startActivity(intent);
                    overridePendingTransition( R.anim.bottom_to_top,0);
                }
               
                return false;
            }
        });

-> This code will change the background image of the button when it is clicked or touched..
here in above code,i placed TextView in LinearLayout in .xml file ,for that i used both TextView and LinearLayout above.
I imaplemented this in my HomeScreen.java file of SnailMail(Letterly) Project..

Comments