Posts

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:" When the error appears instead of…

Text is cut of when you set font and screen zoom set to max in devices Settings->Display->Font and screen zoom

Image
I have faced following issue :

Text is cut of when you set font and screen zoom set to max in devices Settings->Display->Font and screen zoom


Solution :
Previously I have used this  :
<dimen name="sans17">17sp</dimen>Now changed this to :<dimen name="sans17dp">17dp</dimen> Issue was resolved.

Connection failed (Connection reset). Please check network connection and try again in android studio

The following steps may help to fix this issue: Open configuration Select Settings Select HTTP Proxy Change no proxy to auto-direct proxy settings Click check connection . check with any Site. Then problem will resolve.

Problem to resolve Error Popup not displaying for EditText Android

Here i have a special case to show that error popup for Editext ,
I have multiple expandable/collapse rows and each row having that expireDateEdittext EditText.

After expanding the row , initially EditText will just have only error icon inside it and not has Error popup .After clicking on it Date picker dialog need to display.

Here in my case after expanding row Error icon displaying properly But problem is Error Popup not displaying after clicking and setting the wrong date on it.
So, I thought its EditText focus problem after expanding the row.And i have fixed that issue using following process.

XML File : 

 <EditText
                android:id="@+id/expireDateEdittext"
                style="@style/EditText"
                android:layout_width="fill_parent"
                android:layout_height="@dimen/expireDateEdittext_height"
                android:editable="false"
                android:focusable="true"
           …

Code for Drag and Drop image from one position to other position in a line Android

Image
package com.example.dragdropview;

import android.app.Activity;
import android.content.ClipData;
import android.os.Bundle;
import android.view.DragEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.LinearLayout;

public class DragDropActivity extends Activity {

Button bikeImage, vanImage, truckImage;
LinearLayout bikeLayout, vanLayout, truckLayout;
View bikeLine = null, vanLine = null, truckLine = null;

int total, failure = 0;
private boolean showBikeLayout = false, showVanLayout = false,
showTruckLayout = false;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_drag_drop);

bikeImage = (Button) findViewById(R.id.bikeImage);
bikeLine = (View) findViewById(R.id.bikeLine);

vanImage = (Button) findViewById(R.id.vanImage);
vanLine = (View) findViewById(R.id.vanLine);

truckImage = (Button) findViewById(R.id.truckImage)…

Code to Display Help Popup and Hide Popup on touch top of that and outside Android

Image
public class HomeScreenFragment extends Fragment {

/** The help button. */
private ImageView mHelpButton = null;

/** The pop up window. */
private PopupWindow mPopupWindow = null;

/** Initialize the UI.view  elements*/
        mHelpButton = (ImageView) view.findViewById(R.id.helpBtn);
mHelpButton.setOnClickListener(onClickListener);


/** The on click listener. */
OnClickListener onClickListener = new OnClickListener() {

@Override
public void onClick(View v) {

switch (v.getId()) {
case R.id.helpBtn:

mHelpView = getActivity().getLayoutInflater().inflate(
R.layout.help_popup, null);

mPopupWindow = new PopupWindow(mHelpView,
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
mPopupWindow.setFocusable(true);
TextView mPopUpText = (TextView) mHelpView
.findViewById(R.id.helpPopUpText);
mPopUpText.setText(helpText);

/*mPopupWindow.setBackgroundDrawable(new BitmapDrawable(
getResources(), ""));
mPopupWindow.setOutsideTouchable(true);*/

mPopupWindow.setOutsideTouchable(true);
mPopu…