As the title, I transferred to the general Activity method will always be an error
The total run time should be reported ClassNotFoundException, very depressed, novice, seek expert guidance. . . . . . .
I was transferred to an Activity in accordance with the general approach to the operation, is not it wrong? We seek to help, thank you ~ ~ ~ ~ ~
The main program code:
package james.chen;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MyListActivity_01Activity extends Activity {
private Button move_to_list = null;
/ ** Called when the activity is first created. * /
@ Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.main);
move_to_list = (Button) findViewById (R.id.move_to_list);
move_to_list.setOnClickListener (new ToListListener ());
}
class ToListListener implements OnClickListener {
public void onClick (View v) {
Intent intent = new Intent (MyListActivity_01Activity.this, MyListActivity.class);
startActivity (intent);
}
}
}
Here is ListActivity code:
package james.chen;
import java.util.ArrayList;
import java.util.HashMap;
import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
public class MyListActivity extends ListActivity {
ArrayList
HashMap
HashMap
public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.list);
map1.put ("user_name", "Joe Smith");
map1.put ("user_ip", "192.168.0.1");
map2.put ("user_name", "John Doe");
map2.put ("user_ip", "192.168.0.2");
list.add (map1);
list.add (map2);
SimpleAdapter listAdapter = new SimpleAdapter (this, list,
R.layout.item, new String [] {"user_name", "user_ip"}, new int [] {R.id.user_name, R.id.user_ip});
setListAdapter (listAdapter);
}
}
Here is the configuration file:
1.main.xml
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
>
android: layout_height = "wrap_content"
android: text = "@ string / hello"
/>
android: id = "@ + id / move_to_list"
android: layout_width = "fill_parent"
android: layout_height = "wrap_content"
android: text = "Start a listActivity"
/>
2: item.xml
android: layout_width = "fill_parent"
android: layout_height = "wrap_content"
android: orientation = "horizontal"
android: paddingLeft = "10dip"
android: paddingRight = "10dip"
android: paddingTop = "1dip"
android: paddingBottom = "1dip"
>
android: layout_width = "180dip"
android: layout_height = "30dip"
android: textSize = "10pt"
android: singleLine = "true"
/>
android: layout_width = "fill_parent"
android: layout_height = "wrap_content"
android: gravity = "right"
android: textSize = "10pt"
/>
3.list.xml
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
>
android: layout_width = "fill_parent"
android: layout_height = "wrap_content"
android: orientation = "vertical"
>
android: layout_width = "fill_parent"
android: layout_height = "wrap_content"
android: drawSelectorOnTop = "false"
android: scrollbars = "vertical"
>
4.xxxxmanifest.xml
android: versionCode = "1"
android: versionName = "1.0">
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
How no one ah .........
Reply:
Look dizzy, send me mail, I can help you, 596338912@qq.com
Reply:
Friend has sent you later, thank you
Reply:
Results posted remember, Oh
Reply:
Well, good
Reply:
Causing me to find most of the day looking for a landlord that you look outermost label item.xml files, you LinearLayout hit into LineaLayout, less of a 'r', when the layout of the system to help you find the appropriate course of layout classes to help you layout, naturally, they reported ClassNotFound anomaly. Also a suggestion is that it is time to use eclipse, multi-press 'Alt + /' to the index, which would reduce the probability of wrong. The landlord gave me extra points Ha! ! !
Reply:
The landlord was nice, but careless
No comments:
Post a Comment