您好,我正在尝试学习 android 中的屏幕导航
- 我收到此错误,但没有语法错误
- 我已经在下面发布了相关类的代码
CopperChimneyPhotos.java
public class CopperChimneyPhotos extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.copper_chimney_photos);
Button btn=(Button) findViewById(R.id.PhotoButton);
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent pt=new Intent(CopperChimneyPhotos.this,CopperChimneyDesc.class);
startActivity(pt);
}
});
}
}
CopperChimneyDesc.java
public class CopperChimneyDesc extends Activity{
private static String url = "http://url:7002/xxxx/";
private static String url1 = "http://url:7002/xxxx/";
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.copperchimney_desc_screen);
//getting info from listview to display the name in TopNavigationBarCopperChimneyDescActivityName
TextView topdisp=(TextView) findViewById(R.id.TopNavigationBarCopperChimneyDescActivityName);
topdisp.setText(getIntent().getExtras().getString("CC_RES"));
// Creating JSON Parser instance
JSONObjParser jParser = new JSONObjParser();
// getting JSON string from URL
JSONArray json = jParser.getJSONFromUrl(url);
// getting JSON string from URL
JSONArray json1 = jParser.getJSONFromUrl(url1);
try {
for (int i = 0; i < json1.length(); i++) {
JSONObject c = json1.getJSONObject(i);
// Storing each json item in variable
int id = c.getInt("_id");
String TIME = c.getString("RestaurantTime");
TimeMap.put(id, TIME);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
for (int i = 0; i < json.length(); i++) {
JSONObject c = json.getJSONObject(i);
// remaining code
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Button BACKBUTTON=(Button) findViewById(R.id.TopNavigationBarCopperChimneyDescActivityBackButton);
BACKBUTTON.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent emp1=new Intent(CopperChimneyDesc.this,MainActivity.class);
startActivity(emp1);
}
});
Button PHOTOBUTTON=(Button) findViewById(R.id.CopperChimneyPhotosButton);