2018/03/16  補充

現在直接更新Android Studio好像就不用這麼麻煩了~~

文章標籤

小小工程師 發表在 痞客邦 留言(0) 人氣()

想要利用手機裡面的GPS或者網路取得使用者目前所在的位置

 

小小工程師 發表在 痞客邦 留言(0) 人氣()

Http 上傳資料分成很多種格式

下面會提到利用Form-data以及Raw來傳送資料

小小工程師 發表在 痞客邦 留言(0) 人氣()

27355136e2d9329eb2daf96cc927f0ef.gif

上面這張圖片就是利用ViewPager來呈現的

文章標籤

小小工程師 發表在 痞客邦 留言(0) 人氣()

private static String getCurrentTimeZone() {
    Calendar mCalendar = new GregorianCalendar();
    TimeZone mTimeZone = mCalendar.getTimeZone();
    int mGMTOffset = mTimeZone.getRawOffset();
    String tz = String.valueOf(TimeUnit.HOURS.convert(mGMTOffset, TimeUnit.MILLISECONDS));
    Log.d("fragment_schedule","TimeZone:"+tz);
    return tz;
}

 

利用這個function會回傳GMT

文章標籤

小小工程師 發表在 痞客邦 留言(0) 人氣()

ArrayList<ArrayList<Integer>> A=new ArrayList<ArrayList<Integer>>();
ArrayList<ArrayList<Integer>> B=new ArrayList<ArrayList<Integer>>();
ArrayList<ArrayList<ArrayList<Integer>>> C=new ArrayList<ArrayList<ArrayList<Integer>>>();
ArrayList<Integer> a1=new ArrayList<Integer>();
a1.add(1);
a1.add(2);
a1.add(3);
A.add(a1);
ArrayList<Integer> a2=new ArrayList<Integer>();
a2.add(1);
a2.add(2);
a2.add(3);
a2.add(4);
A.add(a2);
C.add(A);
ArrayList<Integer> b1=new ArrayList<Integer>();
b1.add(1);
b1.add(2);
b1.add(3);
B.add(a1);
ArrayList<Integer> b2=new ArrayList<Integer>();
b2.add(1);
b2.add(2);
b2.add(3);
b2.add(4);
B.add(a2);
C.add(B);


文章標籤

小小工程師 發表在 痞客邦 留言(0) 人氣()

以下為完整的程式碼

public class MainActivity extends AppCompatActivity {
    private GridView gridView;
    private int[] image = {R.drawable.one,R.drawable.two,R.drawable.three
    ,R.drawable.four,R.drawable.five};
    private String[] imgtxt = {"1","2","3","4","5"};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        List<Map<String, Object>> items = new ArrayList<>();
        for (int i = 0; i < image.length; i++) {
            Map<String, Object> item = new HashMap<>();
            item.put("image", image[i]);
            item.put("text", imgtxt[i]);
            items.add(item);
        }
        SimpleAdapter adapter = new SimpleAdapter(this,
                items, R.layout.gridview_item, new String[]{"image", "text"},
                new int[]{R.id.image, R.id.text});
        gridView = (GridView)findViewById(R.id.gridview);
        gridView.setNumColumns(2);
        gridView.setAdapter(adapter);
        gridView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
            @Override
            public void onItemClick(AdapterView<?> parent, View view,
            int position, long id) {
                Toast.makeText(MainActivity.this, "Choice " + imgtxt[position],
                Toast.LENGTH_SHORT).show();
            }
        });
    }
}

 

文章標籤

小小工程師 發表在 痞客邦 留言(0) 人氣()

在layout EditText裡面增加屬性

顯示焦點

小小工程師 發表在 痞客邦 留言(0) 人氣()

2018更新

因為我本身開發的App跟生命週期是息息相關的

文章標籤

小小工程師 發表在 痞客邦 留言(0) 人氣()

要讓Android App直接利用Google+來取的使用者資料

Step 1:

文章標籤

小小工程師 發表在 痞客邦 留言(0) 人氣()