« Home « Chủ đề mẹo trong lập trình

Chủ đề : mẹo trong lập trình


Có 20+ tài liệu thuộc chủ đề "mẹo trong lập trình"

Hướng dẫn lập trình với Android part 1

tailieu.vn

Bài này sẽ hướng dẫn cặn kẽ mọi người cách sử dụng Android trong Eclipse, hi vọng giúp những người mới chập chững bước vào lập trình Android có thêm thông tin và biết cách khai thác IDE của mình hiệu quả hơn.. I.Hướng dẫn cài đặt Android với Eclipse:. Thực chất anh Giáp đã viết một bài có nội...

Hướng dẫn lập trình với Android part 2

tailieu.vn

AVD là máy ảo cho developer phát triển ứng dụng. Để tạo 1 AVD bạn vào Windows ->. Cửa sổ Create new AVD hiện ra, bạn điền thông tin cho AVD bạn muốn:. Target: Chọn phiên bản hệ điều hành bạn muốn (thường mình tạo một Android 1.6 và một Android 2.2 để test).. SD Card: gõ vào Size SD...

Hướng dẫn lập trình với Android part 3

tailieu.vn

Hướng dẫn lập trình cơ bản với Android - Bài 1 Yêu cầu kiến thức cho lập trình Android:. Để lập trình android, mình nghĩ mọi người chỉ cần kiến thức java căn bản là hoàn toàn ok. Các kiến thức về các gói lập trình cho desktop như java.awt, java.swing hoàn toàn không cần thiết (bản thân mình cũng...

Hướng dẫn lập trình với Android part 4

tailieu.vn

Như mình đã giới thiệu ở trên , Actitvity là thành phần quan trọng nhất và đóng vai trò chính trong xây dựng ứng dụng Android. VD: một activity mới xuất hiện hiển thị giao diện đè lên trên activity cũ, nhưng giao diện này nhỏ hơn giao diện của activity cũ, do đó ta vẫn thấy được 1 phần...

Hướng dẫn lập trình với Android part 5

tailieu.vn

B4:Vào thư mục layout, chọn file main.xml và gõ đoạn code sau vào thay cho toàn bộ nội dung có sẵn (Eclipse hỗ trợ kéo thả cho xml nhưng theo mình không nên sử dụng):. xmlns:android="http://schemas.android.com/apk/res/andro id". Trong Edit Text và Text View các bạn có thể thấy có từ khóa id, từ khóa này cho phép khai báo id...

Hướng dẫn lập trình với Android part 6

tailieu.vn

Dạo qua một chút kiến thức cơ bản: Trong Android, các lớp sử dụng để tạo giao diện (Edit Text, Text View. Một số lớp thường xuyên được sử dụng để tạo giao diện:. Các Listener được sử dụng để bắt 1 sự kiện nào đó. Ở đây mình sử dụng OnKeyListener dùng để bắt sự kiện khi nhấn 1...

Hướng dẫn lập trình với Android part 7

tailieu.vn

Trong bài 1 mình đã giới thiệu sơ lược về các thành phần cơ bản của Android cũng như việc sử dụng XML để lập trình ứng dụng Android. Mỗi ứng dụng đều cần có AndroidManifest.xml để mô tả những thông tin quan trọng của nó cho hệ thống Android biết. encoding="utf-8"?>. xmlns:android="http://schemas.android.com/apk/res/andro id". android:label="@string/app_name">. <activity android:name=".Example". android:name="android.intent.action.MAIN". android:name="android.intent.category.LAUNCHER". Đặt...

Hướng dẫn lập trình với Android part 8

tailieu.vn

xmlns:android="http://schemas.android.com/apk/res/andro id". android:layout_width="fill_parent". android:layout_height="wrap_content". android:layout_width="wrap_content". android:layout_width="50px". android:id="@+id/hour_edit". android:layout_width="45px". android:layout_width="65px". android:id="@+id/minute_edit". Giao diện ta thiết kế ở đây có 1 Linear Layout làm thành phần chính, các thành phần con của nó gồm 1 Edit Text (dùng để nhập nội dung công việc), 1 Linear Layout (lại gồm các thành phần con để nhập giờ và phút thực hiện công việc),...

Hướng dẫn lập trình với Android part 9

tailieu.vn

import android.app.Activity;. import android.app.AlertDialog;. import android.content.DialogInterface;. import android.os.Bundle;. import android.view.View;. import android.view.View.OnClickListener;. import android.widget.ArrayAdapter;. import android.widget.Button;. import android.widget.EditText;. import android.widget.ListView;. android.R.layout.simple_list_item_1, arrayWork);. (workEnter.getText().toString().equals . hourEdit.getText().toString().equals . minuteEdit.getText().toString().equals("". workEnter.getText().toString. hourEdit.getText().toString. minuteEdit.getText().toString();. android.R.layout.simple_list_item_1, arrayWork). Context thuộc android.content (android.content.Context).. Tiếp theo là android.R.layout.simple_list_item_1, đối này định nghĩa cách thể hiện item (ở đây là String) trong List View. Các bạn hãy ghi nhớ...

Hướng dẫn lập trình với Android part 10

tailieu.vn

xmlns:android="http://schemas.android.com/apk/res/andro id". android:layout_width="wrap_content". android:layout_height="wrap_content". android:id="@+id/work_content". android:id="@+id/time_content". android:layout_width="fill_parent". android:id="@+id/work_enter". android:layout_width="50px". android:id="@+id/hour_edit". android:layout_width="45px". android:layout_width="65px". android:id="@+id/minute_edit". android:id="@+id/button". android:id="@+id/list"

Hướng dẫn lập trình với Android part 11

tailieu.vn

<string name="app_name">Example 3</string>. <string name="work_hint">Enter the work here</string>. <string name="hour_edit">Hour</string>. <string name="minute_edit">Minute</string>. <string name="button_content">Add work</string>. import android.content.Context;. import android.view.LayoutInflater;. import android.widget.CheckBox;. import android.widget.LinearLayout;. import android.widget.TextView;. import android.view.View;. import android.view.ViewGroup;. import android.widget.ArrayAdapter;. import android.widget.CompoundButton;. android.widget.CompoundButton.OnCheckedChangeListener;. TextView workContent = ((CustomViewGroup) workView).workContent;. TextView timeContent = ((CustomViewGroup) workView).timeContent;. work.setChecked(isChecked);. workContent.setText(work.getContent());. timeContent.setText(work.getTime());. checkWork.setChecked(work.isChecked());

Hướng dẫn lập trình với Android part 12

tailieu.vn

import android.app.Activity;. import android.app.AlertDialog;. import android.content.DialogInterface;. import android.os.Bundle;. import android.view.Menu;. import android.view.MenuItem;. import android.view.View;. import android.view.View.OnClickListener;. import android.widget.ArrayAdapter;. import android.widget.Button;. import android.widget.EditText;. import android.widget.ListView;. private static final int DELETE_WORK = Menu.FIRST;. (workEnter.getText().toString().equals . hourEdit.getText().toString().equals . minuteEdit.getText().toString().equals("". AlertDialog.Builder builder = new AlertDialog.Builder(Example.this);. builder.setTitle("Info missing");. builder.setMessage("Please enter all information of the work");. builder.setPositiveButton("Continue", new DialogInterface.OnClickListener(). builder.show();. minuteEdit.getText().toString();. array.add(0, work);. menu.add(0, DELETE_WORK, 0,"Delete"....

Hướng dẫn lập trình với Android part 13

tailieu.vn

Các thuộc tính của Intent:. Ngoài ra còn có 1 số thuộc tính mà ta có thể bổ sung vào Intent:. Khi thuộc tính này được xác định thì các thuộc tính khác sẽ trở thành thuộc tính phụ.. Explicit Intents: intent đã được xác định thuộc tính component, nghĩa là đã chỉ rõ thành phần sẽ nhận và xử...

Hướng dẫn lập trình với Android part 14

tailieu.vn

xmlns:android="http://schemas.android.com/apk/res/andro id". import android.app.Activity;. import android.content.Intent;. import android.os.Bundle;. import android.view.View;. import android.view.View.OnClickListener;. import android.widget.Button;. import android.widget.EditText;

Hướng dẫn lập trình với Android part 15

tailieu.vn

import android.content.BroadcastReceiver;. import android.content.Context;. import android.content.Intent;. import android.widget.Toast;. <activity android:name=".Activity1". android:name="android.intent.action.MAIN". android:name="android.intent.category.LAUNCHER". android:name=".Activity2"></activity>. android:name=".Receiver"></receiver>

Hướng dẫn lập trình với Android part 16

tailieu.vn

Trước khi đi vào ví dụ, hãy dạo qua 1 chút kiến thức về Intent Filter và vai trò của nó.. Intent Filter là gì. Activity, Service và BroadCast Receiver sử dụng Intent Filter để thông báo cho hệ thống biết các dạng Implicit Intent mà nó có thể xử lý. Nói cách khác, Intent Filter là bộ lọc Intent,...

Hướng dẫn lập trình với Android part 17

tailieu.vn

import android.app.Activity;. import android.os.Bundle;. import android.view.Menu;. import android.view.MenuItem;. import android.view.View;. import android.view.View.OnClickListener;. import android.widget.Button;. import android.widget.TextView;. numberView = (TextView) findViewById(R.id.number_display);. button1 = (Button) findViewById(R.id.button1);. button2 = (Button) findViewById(R.id.button2);. button3 = (Button) findViewById(R.id.button3);. button4 = (Button) findViewById(R.id.button4);. button5 = (Button) findViewById(R.id.button5);. button6 = (Button) findViewById(R.id.button6);. button7 = (Button) findViewById(R.id.button7);. button8 = (Button) findViewById(R.id.button8);. button9 = (Button) findViewById(R.id.button9);. button0 = (Button) findViewById(R.id.button0);....

Hướng dẫn lập trình với Android part 18

tailieu.vn

Một Service có thể được sử dụng theo 2 cách:. Nó có thể được bắt đầu và được cho phép hoạt động cho đến khi một người nào đó dừng nó lại hoặc nó tự ngắt. Nó có thể tự ngắt bằng lệnh Service.stopSelf() hoặc Service.stopSelfResult. Service có thể được vận hành theo như đã được lập trình việc sử...

Hướng dẫn lập trình với Android part 19

tailieu.vn

xmlns:android="http://schemas.android.com/apk/res/andro id". Trong bài hôm nay mình sẽ giới thiệu với các bạn cơ sở dữ liệu trên Android - SQLiteDatabase.. Mỗi ứng dụng đều sử dụng dữ liệu, dữ liệu có thể đơn giản hay đôi khi là cả 1 cấu trúc. Trong Android thì hệ cơ sở dữ liệu được sử dụng là SQLite Database, đây là hệ...