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();

}

エラー: android.view.WindowManager$BadTokenException: ウィンドウを追加できません -- トークン android.app.LocalActivityManager$LocalActivityRecord@40e16110 が無効です。あなたの活動は進んでいますか?

問題

別のタブホストを介してアクティビティを呼び出しています。ビューのみをロードしています。Webサービスとボタンが機能していません。ボタンをクリックすると、上記のエラーが表示されます。続行するのを手伝ってください..

参照: http://www.gamma-point.com/content/android-how-have-multiple-activities-under-single-tab-tabactivity

現在、ActivityGroup は非推奨です.., 今何を使用すればよいですか..

4

1 に答える 1

0

あなたが投稿したものについては、まったく使用する必要がないようですActivityGroupFeedbackfromActivityクラスを拡張するだけです。例えば:

public class Feedback extends Activity
于 2013-03-27T09:29:14.590 に答える