0
의도를 전달하려는 Tabbed Activity가 있습니다. 일부 매개 변수를 전달하려고하는데 이는 의도를 전달하지 않습니다. 나는 현재 탭을 onClickListener에 설정하고 있습니다. 내 코드는 아래 코드를 어떻게 사용합니까? 여기 onClickListener의 Tab Activitiy에 의도를 전달하는 방법
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@SuppressLint("InlinedApi")
private void displayEvacRouteTable(){
AsyncClass ac = new AsyncClass(EvacRouteTableActivity.this);
ac.execute();
List<String> evacRouteList = new ArrayList<String>(DALController.sharedInstance().getAllRouteNames());
// get a reference for the TableLayout
TableLayout ll = (TableLayout) findViewById(R.id.TableLayout01);
for (String routeName : evacRouteList){
// create a new TableRow
TableRow row = new TableRow(this);
// create a new TextView
TextView destNameTextView = new TextView(this);
String evacRouteName = " " + routeName;
SpannableString evacRouteSpanString = new SpannableString(evacRouteName);
evacRouteSpanString.setSpan(new UnderlineSpan(), 0, evacRouteName.length(), 0);
destNameTextView.setText(evacRouteSpanString);
destNameTextView.setTextColor(Color.BLUE);
destNameTextView.setTextSize(20);
destNameTextView.setHeight(55);
Linkify.addLinks(evacRouteSpanString, Linkify.ALL);
final Intent i = new Intent(EvacRouteTableActivity.this, MapViewActivity.class);
Bundle b = new Bundle();
b.putString("evacObject", routeName);
i.putExtras(b);
destNameTextView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
AsyncClass ac = new AsyncClass(EvacRouteTableActivity.this);
ac.execute();
@SuppressWarnings("deprecation")
TabActivity ta = (TabActivity) EvacRouteTableActivity.this.getParent();
ta.getTabHost().setCurrentTab(4);
}
});
destNameTextView.setBackgroundResource(R.drawable.cell_shape);
destNameTextView.setLayoutParams(new TableRow.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
row.addView(destNameTextView);
ll.addView(row,new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}
}
내가 의도받는 데 사용하려고 코드입니다 :
String fuelStopBundle = getIntent().getExtras();
if (fuelStopBundle != null){
evacName = fuelStopBundle.getString("evacObject");
정확히 코드가 동작하기를 원하십니까? – dd619
문자열 매개 변수를 다른 탭의 Google지도에 전달하고 있습니다. 지도 상에 그릴 필요가있는 경로의 이름입니다. – yams
의도를 통해 문자열을 전달할 필요가 없습니다. 문자열을 정적 변수로 선언 한 다음 아무 데나 액세스 할 수 있습니다. – dd619