Skip to content

Instantly share code, notes, and snippets.

View Bhavdip's full-sized avatar
🎯
Focusing

bhavdip Bhavdip

🎯
Focusing
View GitHub Profile
@Bhavdip
Bhavdip / sample_fragment.xml
Created July 22, 2016 08:30
Fragment and View Pager
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/first_fragment_root">
<TextView android:layout_height="wrap_content"
android:text="@string/text_first_fragment_title"
android:layout_width="match_parent"
public class SampleFragment extends Fragment implements OnClickListener {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.sample_fragment,container, false);
Button nextButton = (Button) view.findViewById(R.id.button_first);
nextButton.setOnClickListener(this);
return view;
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment android:name="com.example.SimpleFragment"
android:id="@+id/simplefragment"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="match_parent" />
FragmentManager fragmentManager = getFragmentManager()
// Or: FragmentManager fragmentManager = getSupportFragmentManager()
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
SimpleFragment fragment = new SimpleFragment();
fragmentTransaction.add(R.id.fragment_container, fragment);
fragmentTransaction.commit();
@Bhavdip
Bhavdip / sketch-never-ending.md
Created October 6, 2016 15:53
Modify Sketch to never ending trial

###Sketch trial non stop

Open hosts files:

$ open /private/etc/hosts

Edit the file adding:

127.0.0.1 backend.bohemiancoding.com

127.0.0.1 bohemiancoding.sketch.analytics.s3-website-us-east-1.amazonaws.com

@Bhavdip
Bhavdip / gist:0da08da8454918eb44263d2f48d41a89
Last active April 16, 2017 05:53
[How to edit the Host file in Mac using terminal]#tags:MacOS
1. Open the Terminal window
2. Type the command 'sudo nano open /private/etc/hosts'
3. Press the enter
4. It will prompt the sudo password
5. Enter the password
6. Its open the vim editer where you can modifiy and enter the new entry using control+ command.
7. The command will display at end of console.
@Bhavdip
Bhavdip / CreditCardEditText.java
Last active April 16, 2017 05:51 — forked from alphamu/CreditCardEditText.java
[A simple EditText view for use with Credit Cards. It shows an image of the credit card on the right hand side. #Credit Cards] #tags:Android
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.AppCompatEditText;
import android.util.AttributeSet;
import android.util.SparseArray;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Bhavdip
Bhavdip / SeparatorTextView.java
Last active April 16, 2017 05:35 — forked from alphamu/SeparatorTextView.java
[SeparatorTextViewSample:SeparatorTextView] #tags:Android
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Build;
import android.util.AttributeSet;
import android.view.Gravity;
import android.widget.TextView;
/**
* Simple version used in the article:
@Bhavdip
Bhavdip / reference.link
Last active April 16, 2017 06:27
[AndroidSlidingUpPanel,DrawerLayout] #tags:Android,AndroidLink
@Bhavdip
Bhavdip / refere.txt
Created April 16, 2017 06:24
[AndroidStudios Layout Preview Enable] #tags:AndroidLink
http://stackoverflow.com/questions/16660039/where-is-android-studio-layout-preview