0
public class Feedback extends ActivityGroup {
protected static LocalActivityManager mLocalActivityManager;
private EditText fd=null;
private Button send=null;
public int res_flag=0;
public String result="";
public String url="";
private RelativeLayout newaccount;
private TextView needhelp=null;
private String currentDateandTime="";
private boolean isonline;
protected String fd_text="";
public void replaceContentView(String id, Intent newIntent) {
View view = getLocalActivityManager().startActivity(id,newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) .getDecorView(); this.setContentView(view);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.feedback);
initialization();
try{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
currentDateandTime = sdf.format(new Date());
}catch (Exception e) {
System.out.println(e);
}
send.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Feedback.Retrieve().execute();
}
});
}
private void initialization()
{
fd=(EditText)findViewById(R.id.fd);
send=(Button)findViewById(R.id.send);
}
class Retrieve extends AsyncTask<Void, Integer, Integer> {
ProgressDialog pd = null;
@Override
protected void onPreExecute() {
// TODO Auto-generated method stub
super.onPreExecute();
pd = new ProgressDialog(Feedback.this);
pd.setMessage("Please wait while sending feedback..");
pd.setCancelable(false);
pd.show();
}
@Override
protected Integer doInBackground(Void... params) {
try{
System.out.println("IN BKGRND");
StrictMode.ThreadPolicy policy1 = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy1);
url="url"+fd_text.toString().trim()+"&datetime="+currentDateandTime;
url=url.replace(" ","%20");
url=url.replace("+","%2B");
System.out.println(url);
JSONObject json = JSONfunctions.getJSONfromURL(url);
JSONObject response1=json.getJSONObject("response");
result=response1.getString("Success").toString().trim();
System.out.println(result);
if(result.equalsIgnoreCase("1"))
{
System.out.println("Logged In");
res_flag=1;
}
else
{
System.out.println("failed");
res_flag=5;
}
}
catch (JSONException e) {
System.out.println(e);
}catch (Exception e) {
System.out.println(e);
}
return null;
}
@Override
protected void onPostExecute(Integer result) {
super.onPostExecute(result);
pd.dismiss();
}tabhost groupactivity不工作(不建议使用)
错误是: android.view.WindowManager $ BadTokenException:无法添加窗口 - 令牌[email protected]无效;你的活动正在运行?
问题
我通过另一个tabhost调用活动,它仅加载.The互联网服务和按钮不工作的视图中,当我点击按钮,这表明上述error.Help我继续家伙。 。
参考: http://www.gamma-point.com/content/android-how-have-multiple-activities-under-single-tab-tabactivity
现在的ActivityGroup已经过时..,我现在应该使用什么样的..
我在另一个类文件的TabActivity ..当我点击一个网页不应该来了,是我编写GroupActivity..Reference HTTP的tabhost..For出来://www.gamma -point.com/content/android-how-have-multiple-activities-under-single-tab-tabactivity – Coder 2013-03-27 09:32:21
就像我说的,你发布的代码并不需要使用ActivityGroup。用Activity替换它看看它是如何去的。 – waqaslam 2013-03-27 09:51:51
View view = getLocalActivityManager()。startActivity(id,newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView(); this.setContentView(视图); 虽然我改变太活动上述行不接受getLocalActivityManager().. – Coder 2013-03-27 11:25:45