Skip to content

Instantly share code, notes, and snippets.

View DanishAmjad12's full-sized avatar
🎯
Focusing

Danish DanishAmjad12

🎯
Focusing
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:orientation="horizontal"
tools:context="com.example.daamjad.googleapiclient.MainActivity">
<TextView
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
getWindow().setBackgroundDrawable(null);
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:orientation="horizontal"
tools:context="com.example.daamjad.googleapiclient.MainActivity">
<TextView
//region Helper method for PreLollipop TextView & Buttons Vector Images
public static Drawable setVectorForPreLollipop(int resourceId, Context activity) {
Drawable icon;
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
icon = VectorDrawableCompat.create(activity.getResources(), resourceId, activity.getTheme());
} else {
icon = activity.getResources().getDrawable(resourceId, activity.getTheme());
}
return icon;
ProjectUtils.setVectorForPreLollipop(Edittext,R.drawable.mic, activity, ApplicationConstants.DRAWABLE_RIGHT);
private void onLocationReceived() {
String location = getLocationName(mLocationModel.getLat(), mLocationModel.getLng());
if(location!=null && !location.isEmpty())
//your work
}
private String getLocationName(double lattitude, double longitude) {
String locationStr = "";
Geocoder gcd = new Geocoder(getActivity(), Locale.getDefault());
private void onLocationReceived() {
String location = getLocationName(mLocationModel.getLat(), mLocationModel.getLng());
if(!TextUtils.isEmpty(location))
//your work
}
private String getLocationName(double lattitude, double longitude) {
String locationStr = "";
Geocoder gcd = new Geocoder(getActivity(), Locale.getDefault());
try {
private void openDrawerActivity(final Class className) {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ProjectUtils.genericIntent(NewDrawer.this, className, null, false);
}
}, 200);
}
private int clickedNavItem = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
/**
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@id/menu_action_search"
android:orderInCategory="1"
android:icon="@drawable/ic_menu_search_blue"
app:iconTint="#008aff"
app:showAsAction="always"
app:actionViewClass="android.support.v7.widget.SearchView"
android:title="@string/menu_search"/>