Skip to content

Instantly share code, notes, and snippets.

.....
android {
.....
buildTypes {
debug {
applicationIdSuffix ".debug"
....
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package=".......">
<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
#pragma mark Collection Layout Delegate
-(CGSize)collectionView:(UICollectionView *)collectionView
layout:(UICollectionViewLayout *)collectionViewLayout
sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
NSUInteger item = indexPath.item;
if (item < [self.pageResult.results count] && indexPath.section == 0) {
//------------ 重點 ------------
// savedlocation_x <- 原 List
List<Integer> copy2=new ArrayList<>(savedlocation_x); // 將 savedlocation_x copy 至新的 list
//改成下列寫法
int i = 0;
int breakIndex = 4;
for(Integer in : savedlocation_x){
if(i > breakIndex){
break;
}
public class PersonalData extends Activity {
public static class ContactList extends BaseAdapter implements Filterable {
}
}
@Kun-Yao-Lin
Kun-Yao-Lin / MainPagerAdapter.java
Created February 17, 2016 17:12
Viewpager view adapter
public class MainPagerAdapter extends PagerAdapter {
// This holds all the currently displayable views, in order from left to right.
private ArrayList<View> views = new ArrayList<View>();
//-----------------------------------------------------------------------------
// Used by ViewPager. "Object" represents the page; tell the ViewPager where the
// page should be displayed, from left-to-right. If the page no longer exists,
// return POSITION_NONE.
@Override
public int getItemPosition (Object object){
@Kun-Yao-Lin
Kun-Yao-Lin / Util.java
Created January 31, 2016 05:44
getFilePathFromUri
public static String getImagePath(Context context, Uri uri){
Cursor cursor = context.getContentResolver().query(uri, null, null, null, null);
cursor.moveToFirst();
String document_id = cursor.getString(0);
document_id = document_id.substring(document_id.lastIndexOf(":")+1);
cursor.close();
cursor = context.getContentResolver().query(
android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
null, MediaStore.Images.Media._ID + " = ? ", new String[]{document_id}, null);
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="tw.com.arnold_lin.customlistview" >
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
@Kun-Yao-Lin
Kun-Yao-Lin / MainPane2.java
Last active August 29, 2015 14:17
TestAdapter
package lib.arnold.com.tw.sample;
import android.app.Activity;
import android.os.Bundle;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Toast;
import java.util.ArrayList;
@Kun-Yao-Lin
Kun-Yao-Lin / MainActivity
Created January 11, 2015 09:52
AS Workshop - part 2
package tw.com.akdg.helloandroidstudio;
import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.util.Log;
import android.widget.ImageView;
import com.baoyz.widget.PullRefreshLayout;