Skip to content

Instantly share code, notes, and snippets.

@JetXing
JetXing / FixRefresh
Created March 23, 2015 04:14
解决SwipeRefreshLayout嵌套ListView时,滑动ListView触发SwipeRefreshLayout的refresh method
/**
* 解决listview向上滑动刷新的bug
*/
mListView.setOnScrollListener(new AbsListView.OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
@JetXing
JetXing / ActivityToView.java
Last active September 10, 2015 05:53
Activity convertion to View
/**
* <p>Helper class for managing multiple running embedded activities in the same
* process. This class is not normally used directly, but rather created for
* you as part of the {@link android.app.ActivityGroup} implementation.
*
* @see ActivityGroup
*
* @deprecated Use the new {@link Fragment} and {@link FragmentManager} APIs
* instead; these are also
* available on older platforms through the Android compatibility package.
@JetXing
JetXing / StringReverse.java
Created February 10, 2015 05:07
reverse String
public String reverseString(String data){
return new StringBuffer(data).reverse().toString();
}
@JetXing
JetXing / CheckEmail.java
Created February 2, 2015 09:08
we much have to sure that entered email address is valid of not and there for to check it followed method can be use
public boolean eMailValidations(String emailstring){
Pattern emailPattern = Pattern.compile(".+@.+\\.[a-z]+");
Matcher emailMatcher = emailPattern.matcher(emailstring);
return emailMatcher.matches();
}
//call method
eMailValidations("jet@jet.com");
@JetXing
JetXing / Sample.java
Created November 24, 2014 10:21
Generate the specified string
package com.example;
import java.util.ArrayList;
import java.util.List;
public class MyClass {
public static void main(String[] args){
UserBuild mUserBuild = new UserBuild("INTEGER");
@JetXing
JetXing / includeToolbar.java
Last active August 29, 2015 14:09
instead actionbar below 3.0
private Toolbar toolbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getLayoutResource());
toolbar = (Toolbar) findViewById(R.id.toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);