浙江上海全国各地手机流量查询工具
这个问题纠结我很久了,那位大虾要是看到了,帮我解决一下,谢谢了问题出在public void onTabActivityResult(int requestCode, int resultCode, Intent data) 这个方法里,在这个方法里调用
adapter = new ContactMainAdapter(AddNewActivity.this, list);
listView.setAdapter(adapter);
adapter.notifyDataSetChanged();
这样死活不更新,而不在这个方法里调用addDataSource()这个方法,是可以正常显示数据刷新的,我在里面这样调用这个方法也没用
下面这个是TabHost的那个Activity一段代码
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// 获取当前活动的Activity实例
@SuppressWarnings("deprecation")
Activity subActivity = manager.getCurrentActivity();
//判断是否实现返回值接口
if (subActivity instanceof OnTabActivityResultListener) {
//获取返回值接口实例
OnTabActivityResultListener listener = (OnTabActivityResultListener) subActivity;
//转发请求到子Activity
listener.onTabActivityResult(requestCode, resultCode, data);
}
super.onActivityResult(requestCode, resultCode, data);
}
public interface OnTabActivityResultListener {
public void onTabActivityResult(int requestCode, int resultCode, Intent data);
}
package com.vzo.eightpartycall.activity;
import java.util.ArrayList;
import java.util.List;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.LocalActivityManager;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewStub;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.vzo.eightpartycall.R;
import com.vzo.eightpartycall.activity.MainActivity.OnTabActivityResultListener;
import com.vzo.eightpartycall.adapter.ContactMainAdapter;
import com.vzo.eightpartycall.bean.ContactBean;
public class AddNewActivity extends Activity implements OnClickListener,OnTabActivityResultListener {
private static final String TAG = AddNewActivity.class.getSimpleName();
private TextView tv_minute;
private Button bt_cacel, bt_add, bt_softKey, add_contact;
private ListView listView;
private ImageButton ib_sms, ib_call, ib_collet;
private RelativeLayout relayout;
private LinearLayout llayoutButton;
private LinearLayout topLayout;
private Dialog smsDialog;
private View smsView;
private EditText ed_title, ed_month, ed_day, ed_hour;
private EditText ed_emcee, ed_bafanghao, ed_passWord;
private Button bt_ensure, bt_cancel;
private ViewStub stub;
private List<ContactBean> list = new ArrayList<ContactBean>();
private ContactMainAdapter adapter;
private Handler handler = new Handler(){
public void handleMessage(Message msg) {
switch (msg.what) {
case 1:
addDataSource();
break;
default:
break;
}
};
};
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
Log.i(TAG,"onCreate");
setContentView(R.layout.addnew);
initView();
// addDataSource();
}
private void initView() {
tv_minute = (TextView) findViewById(R.id.avariable_minute);
bt_cacel = (Button) findViewById(R.id.topCancelButton);
bt_cacel.setOnClickListener(this);
bt_add = (Button) findViewById(R.id.topAddButton);
bt_add.setOnClickListener(this);
bt_softKey = (Button) findViewById(R.id.topSoftButton);
bt_softKey.setOnClickListener(this);
ib_sms = (ImageButton) findViewById(R.id.smsImageButton);
ib_sms.setOnClickListener(this);
ib_call = (ImageButton) findViewById(R.id.callImageButton);
ib_call.setOnClickListener(this);
ib_collet = (ImageButton) findViewById(R.id.collectImageButton);
ib_collet.setOnClickListener(this);
listView = (ListView) findViewById(R.id.listView);
relayout = (RelativeLayout) findViewById(R.id.relayout);
add_contact = (Button) findViewById(R.id.addContact);
add_contact.setOnClickListener(this);
llayoutButton = (LinearLayout) findViewById(R.id.llayoutButton);
topLayout = (LinearLayout) findViewById(R.id.toplayout);
}
private void addDataSource(){
Log.i("lanjianlong","addDataSource");
for (int i = 0; i < 10; i++) {
ContactBean cb = new ContactBean();
cb.setDisplayName("name"+i);
cb.setPhoneNum("123456"+i);
list.add(cb);
}
adapter = new ContactMainAdapter(AddNewActivity.this, list);
listView.setAdapter(adapter);
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0,
View arg1, int arg2, long arg3) {
// TODO Auto-generated method stub
if(adapter.isButtonGone)
adapter.isButtonGone = false;
else
adapter.isButtonGone = true;
adapter.notifyDataSetChanged();
return false;
}
});
relayout.setVisibility(View.GONE);
// llayoutButton.setVisibility(View.GONE);
// add_contact.setVisibility(View.GONE);
listView.setVisibility(View.VISIBLE);
adapter.notifyDataSetChanged();
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent intent = null;
switch (v.getId()) {
case R.id.topCancelButton:
if(list != null && adapter != null){
list.clear();
adapter.setDateList(list);
adapter.notifyDataSetChanged();
}
break;
case R.id.topAddButton:
intent = new Intent();
intent.putExtra("where", "AddNewActivity");
intent.setClass(AddNewActivity.this, InviteFriendActivity.class);
getParent().startActivityForResult(intent, 1);
break;
case R.id.topSoftButton:
getWindow().setSoftInputMode
(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
break;
case R.id.smsImageButton:
smsView = LayoutInflater.from(AddNewActivity.this).inflate(R.layout.sms_model, null);
// smsView.setVisibility(View.VISIBLE);
// listView.setVisibility(View.GONE);
// relayout.setVisibility(View.GONE);
// topLayout.setVisibility(View.GONE);
// stub = (ViewStub) findViewById(R.id.smsview);
// stub.inflate();
ed_title = (EditText) smsView.findViewById(R.id.ed_title);
ed_month = (EditText) smsView.findViewById(R.id.ed_month);
ed_day = (EditText) smsView.findViewById(R.id.ed_day);
ed_hour = (EditText) smsView.findViewById(R.id.ed_hour);
ed_emcee = (EditText) smsView.findViewById(R.id.ed_emcee);
ed_bafanghao = (EditText) smsView.findViewById(R.id.ed_bafanghao);
ed_passWord = (EditText) smsView.findViewById(R.id.ed_password);
bt_ensure = (Button) smsView.findViewById(R.id.bt_ensure);
bt_ensure.setOnClickListener(this);
bt_cancel = (Button) smsView.findViewById(R.id.bt_cancel);
bt_cancel.setOnClickListener(this);
AlertDialog.Builder builder = new AlertDialog.Builder(AddNewActivity.this);
builder.setView(smsView);
smsDialog = builder.create();
smsDialog.show();
break;
case R.id.callImageButton:
intent = new Intent();
intent.putExtra("where", "AddNewActivity");
intent.setClass(AddNewActivity.this, CallPhoneActivity.class);
startActivity(intent);
break;
case R.id.collectImageButton:
break;
case R.id.addContact:
intent = new Intent();
intent.putExtra("where", "AddNewActivity");
intent.setClass(AddNewActivity.this, InviteFriendActivity.class);
getParent().startActivityForResult(intent, 1);
break;
case R.id.bt_ensure:
// smsView.setVisibility(View.GONE);
// topLayout.setVisibility(View.VISIBLE);
smsDialog.dismiss();
listView.setVisibility(View.VISIBLE);
Toast.makeText(AddNewActivity.this, "ensure is onClick", Toast.LENGTH_SHORT).show();
break;
case R.id.bt_cancel:
// smsView.setVisibility(View.GONE);
// Log.i("lanjianlong","list, listView = "+listView);
// listView.setVisibility(View.VISIBLE);
// topLayout.setVisibility(View.VISIBLE);
smsDialog.dismiss();
Toast.makeText(AddNewActivity.this, "cnacel is onClick", Toast.LENGTH_SHORT).show();
break;
default:
break;
}
}
@Override
public void onTabActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
Log.i("lanjianlong","AddNewActivity, onTabActivityResult(), data = "+data);
Log.i("lanjianlong","AddNewActivity, onTabActivityResult, requestCode = "+requestCode+", resultCode = "+resultCode+", Activity.RESULT_OK="+Activity.RESULT_OK);
addDataSource();//这个方法不在这里调用是可以显示数据的,在此调用,怎么都没反应,这个方法是放在这里测试的
//下面的是另一个Activity返回的数据,数据可以返回,数据有打印出来
if(requestCode == 1){
if(data == null)
return;
Bundle bd = data.getExtras();
list.clear();
List<ContactBean> tempList = (List<ContactBean>) bd.getSerializable("lists");
ContactBean cb = null;
for (int i = 0; i < tempList.size(); i++) {
cb = new ContactBean();
cb.setDisplayName(tempList.get(i).getDisplayName());
cb.setPhoneNum(tempList.get(i).getPhoneNum());
list.add(cb);
Log.i("lanjianlong","AddNewActivity, onTabActivityResult, name, phone = "+tempList.get(i).getDisplayName()+", "
+tempList.get(i).getPhoneNum()+", list.size() = "+list.size());
}
Log.i("lanjianlong","onTabActivityResult, tempList = "+tempList);
if(list.size() > 0){
listView = null;
listView = (ListView) findViewById(R.id.listView);
relayout.setVisibility(View.GONE);
listView.setVisibility(View.VISIBLE);
adapter = new ContactMainAdapter(AddNewActivity.this, list);//在此重新new 或者不new 效果都是一样的,数据就是不更新
listView.setAdapter(adapter);
adapter.notifyDataSetChanged();
Log.i("lanjianlong", "onTabActivityResult, list.size() = "+list.size());
}else{
relayout.setVisibility(View.VISIBLE);
listView.setVisibility(View.GONE);
Log.i("lanjianlong", "onTabActivityResult, else");
}
}
// super.onActivityResult(requestCode, resultCode, data);
}
}
写在前面,表弟买了部HTC G10 HD ,帮他root了两次都折腾了几个小时没成功,今天第三次root,弄到夜里2点多终于成功,前后花了10多个小时吧。
失败原因主要是网上教程比较老了,还有一些东西没说清楚。在查找了大量资料与机友的回答后,终于找到了问题所在。
整理好了,其实也很简单。下面开始。
涉及的重点如下:
1. 解锁 ( S-OFF)。
2. recovery时候PD98IMG.ZIP版本太低
文章的图我也懒得上传了,这篇文章就做个简介吧,设计到的完整资料与工具都在附件中了
附件下载: 下载地址一 下载地址二
第一步:解锁!(见文档《HTC G10官方解锁全过程》)
第二步:卡刷入recovery,将文件PD98IMG.ZIP打开,打开里面有个“android-info.txt”,会看到
“mainver: 1.28.405.1”,然后在手机设置,关于手机,软件信息里面查看当前版本,我的是3.13.707.1,那么我就将刚才的那个文件里面的“mainver: 1.28.405.1”修改为“mainver: 3.13.707.5”,保存。如果不修改,会提示报错“main version is older update fail ”。
PD98IMG.ZIP千万别解压出来,然后放到手机内存卡的根目录下不要解压(不要放在文件夹里),然后关机,拔掉数据线,扣电池盖抖出电池后重装上。然后按住音量键的下键不松加电源开机键,进入画面不要动等屏幕出现YES或NO,再按音量键的上键一次(不能按下键),显示recovery ok在按电源键 成功后重启,重启之后,进入sd卡根目录删除PD98IMG压缩文件。
第三步:把文件“Superuser-3.0.7-efghi-signed”放到根目录中,之后再关机,扣电池盖抖出电池一半后重装上,按音量键下键加电源开机键进入,进去之后,按音量键减选择第二项recovery后,再按电源键确认,进去后,再选择install from sdcard后,按电源键确认,进去后,再选择choose zip from sdcard,按电源键确认,最后按音量加键选择到最底下的压缩文件Superuser-3.0.7-efghi-signed,再按电源键确认后,再选择yes开头的,再按电源开关键确认,安装完后,再按手机上的返回图标,按电源开关键确认后手机自动重启后,root成功!
不一定非要s-off才能刷机,只要手机上方显示unclocked,就可以刷第三方rom.
HTC G10不解锁,就很多事情做不了,就体验不到用安卓的乐趣了,下面就给出官方的解锁教程,都你HTC G10如何解锁。
首先打开这个网站:http://www.htcdev.com/bootloader
先在绿框里选择自己的机型,也就是HTC Desire HD ,然后点开下图中红框的位置:
这里需要登录,相信大多数人都没有帐号,所以点Regsister Now注册新账号
按照下图的中文提示,输入信息,注意邮箱一定要填写真的,这个很重要,之后的激活以及解锁文件都会发到这个邮箱
下面就去刚才填的邮箱激活帐号,有可能会在垃圾邮件中
激活帐号后,登录你刚才注册的帐号,还是点下图中红框中的绿色按钮
点YES
把两个框勾选
按照下图的介绍,进入bootloader
注册好后就开始获取解锁码 这里下载个一键获取解锁码小工具 非常的简单方便。
1.首先进入bootloader界面 上面有介绍 我就不多说了 大概是一个这样的界面 然后把手机连接到电脑上 等驱动安装完成后开始下面步骤
2.然后打开一键获取解锁码[见附件]
文件夹里的 会看到下图界面【提示:一键获取解锁码需要解压缩】
3.按照提示点任意键就可以获取到解锁码了,如图:
4.要复制的区域是这块,看仔细了,下面的白色区域就是解锁码【复制的问题我给说明一下吧,鼠标右键选择标记,就可以复制了】
5.把代码复制到下面的图的方框里,下面的方框在官方解锁步骤的第十步,step10。
6.之后系统会给你注册的邮箱给你发一个带Unlock_code.bin附件的电子邮件,然后你把那个附件下载下来。
如图
然后打开一键解锁[见附件]
文件夹里的会看到下图界面【提示:一键解锁需要解压缩】
7.然后一键解锁会自动为你解锁,当解锁成功后,手机会出现下图这个画面让你选择,用音量键选择YES,电源键确认,就解锁成功了!