本人测试的
可以监听到软键盘的回车按钮
以及手机的物理按钮
etEditText.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { // TODO Auto-generated method stub System.out.println("View:" + v + "KeyCode:" + keyCode + "KeyEvent:" + event); return false; } });
软件介绍:
联通话费速查是一款针对联通用户开发的,帮助用户查询话费余额、账单、用户信息、账号信息以及上网流量等的Android应用,所有查询只需您一键点击即可,让您随时掌握话费使用情况。
同时还提供归属地查询等实用功能,方便您的日常生活。
该软件是上一个软件 话费速查 http://www.iteye.com/topic/1122622 的联通版本。
v1.2
修复电信运营商识别错误
修复电信归属地查询错误
在关于信息中添加版本号
下载地址 : 话费速查升级版v1.2
软件截图:
欢迎大家拍砖~
package com.scope.view;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.scope.R;
import com.scope.util.FileOp;
import android.app.Activity;
import android.app.LauncherActivity;
import android.app.ListActivity;
import android.graphics.Path;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.AbsListView;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
public class FileManagerActivity extends Activity {
private TextView file_path;
private ListView lv;
File path = Environment.getExternalStorageDirectory();
String root_path = path.getAbsolutePath();
List<Map<String, Object>> list;
Map<String, Object> map;
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
file_path = (TextView) findViewById(R.id.file_path);
file_path.setText(root_path);
lv = (ListView) findViewById(R.id.list);
lv.setAdapter(getDeviceListAdapter(root_path));
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int pos, long id) {
Map<String, Object> item = (Map<String, Object>) parent.getItemAtPosition(pos);
String file_abs_path = (String) item.get("file_abs_path");
System.out.println("file_abs_path " + file_abs_path);
File file = new File(file_abs_path);
if (!file.exists()) {
// finish();
return;
}
if(file.isDirectory()){
System.out.println("file_abs_pat" + file_abs_path);
lv.setAdapter(getDeviceListAdapter(file_abs_path));
file_path.setText(file_abs_path);
}else{
}
}
});
}
private List<Map<String, Object>> getFile(String file_path) {
list = new ArrayList<Map<String, Object>>();
File file = new File(file_path);
for (File files : file.listFiles()) {
map = new HashMap<String, Object>();
String file_abs_path = files.getAbsolutePath();
map.put("file_abs_path", file_abs_path);
if (files.isDirectory()) {
map.put("item_type", R.drawable.item_type_dir);
map.put("item_name", files.getName());
map.put("item_sel", R.drawable.item_img_nosel);
long file_date = files.lastModified();
String date = new SimpleDateFormat("yyyy/MM/dd HH:mm")
.format(new Date(file_date));
map.put("item_date", date + " | ");
// long file_size = file.length();
// map.put("item_size", file_size + " | ");
list.add(map);
} else {
map.put("item_name", files.getName());
map.put("item_type", FileOp.getFileTypeImg(files.getName()));
map.put("item_sel", R.drawable.item_img_nosel);
long file_date = files.lastModified();
String date = new SimpleDateFormat("yyyy/MM/dd HH:mm")
.format(new Date(file_date));
map.put("item_date", date + " | ");
long file_size = files.length();
map.put("item_size", FileOp.getFileSizeStr(file_size)+ " | ");
list.add(map);
}
}
return list;
}
private ListAdapter getDeviceListAdapter(String file_path) {
return new SimpleAdapter(FileManagerActivity.this, getFile(file_path),
R.layout.filelist_item, new String[] { "item_type",
"item_name", "item_sel", "item_size", "item_date" },
new int[] { R.id.item_type, R.id.item_name, R.id.item_sel,
R.id.item_size, R.id.item_date });
}
}