Toast 数据加载,内容加载,网络图片加载提示
数据加载完毕提示:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/tv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="等待数据加载……"
/>
</LinearLayout>
功能代码实现:
创建一个线程,用来加载
package com.ncsyeyy.YeyyToast;
import android.app.Activity;
import android.os.Bundle;
import android.os.Message;
import android.os.Handler;
import android.widget.TextView;
import android.widget.Toast;
public class MyActivity extends Activity {
// 定义thread返回的id表示
private final int HANDLER_TEST = 0;
/**
* Called when the activity is first created.
*/
private Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case HANDLER_TEST:
Toast.makeText(MyActivity.this, "数据加载完毕", Toast.LENGTH_LONG).show();
tv.setText("数据加载完毕");
break;
}
}
};
private TextView tv;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv = (TextView) findViewById(R.id.tv);
new Thread() {