this is MainActivity
//class declare
public class MainActivity extends Activity {
// a lot of code
}
//OnCreate Set
setContentView(R.layout.activity_main);
and Inside having a TableLayout with ID R.id.widget101
, TableLayout having a dynamic created LinearLayout.
here is the second activity code,trying to get the MainActivity TableLayout and get all the inside LinearLayout child
//class declare
public class SecondActivity extends Activity {
// a lot of code
}
//OnCreate Set
setContentView(R.layout.second);
public void EnableButton(boolean bool){
View view = LayoutInflater.from(getApplication()).inflate(R.layout.activity_main, null);
ViewGroup layout = (ViewGroup) view.findViewById(R.id.widget101);
if (layout != null){
Log.d(null,"EnableButton getchild="+layout.getChildCount()+"");
Log.d(null,"EnableButton Function");
}
}
Problem Occurs here, When the Second Aciticity calling the MainActivity to get the TableLayout Child are return 0
===============================================================
this is how i call the SecondActivity
public class MainActivity extends Activity
implements OnClickListener {
//overrides the OnClickListener interface method
@Override
public void onClick(View arg0) {
if(arg0.getId() == R.id.btnWEmas){
//define a new Intent for the second Activity
Intent intent = new Intent(this,SecondActivity.class);
intent.putExtra("From_LocationName",global.From_LocationName);
intent.putExtra("To_LocationName",global.To_LocationName);
TextView textview = (TextView) findViewById(R.id.lblPrice);
intent.putExtra("Price",textview.getText());
//start the second Activity
this.startActivity(intent);
}
// still have a lot of code