List Activity

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

List Activity

Postby SamB09 » Wed Dec 30, 2009 2:19 pm

Hi guys, ive got a list view that is populated from sqllite, however i want to call this list activity from a button , ive tried using my intent , but when i click the button the screen just goes blank. Heres some code.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2. public class Screen1 extends Activity  {
  3.  
  4.        
  5.  
  6.        
  7.  
  8.        
  9.  
  10. public void onCreate(final Bundle savedInstanceState) {
  11.  
  12.     super.onCreate(savedInstanceState);
  13.  
  14.  
  15.  
  16.    
  17.  
  18.     setContentView(R.layout.main);
  19.  
  20.     Button button1 = (Button) findViewById(R.id.button1);
  21.  
  22.     button1.setText("click");
  23.  
  24.    
  25.  
  26.  
  27.  
  28.     button1.setOnClickListener(new View.OnClickListener()  {
  29.  
  30.         public void onClick(View v) {
  31.  
  32.             // Perform action on clicks
  33.  
  34.        
  35.  
  36.                  Intent myIntent = new Intent(v.getContext(), CreateLineUpDB.class);
  37.  
  38.              startActivityForResult(myIntent, 0);
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.     }}); }}
  47.  
  48.    
Parsed in 0.031 seconds, using GeSHi 1.0.8.4

Can anyone help? Thanks
SamB09
Developer
Developer
 
Posts: 39
Joined: Tue Oct 27, 2009 9:22 pm
Location: England

Top

Re: List Activity

Postby sabs » Wed Dec 30, 2009 4:11 pm

SamB09 wrote:Hi guys, ive got a list view that is populated from sqllite, however i want to call this list activity from a button , ive tried using my intent , but when i click the button the screen just goes blank. Heres some code.

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. public class Screen1 extends Activity  {
  2.        
  3.        
  4.        
  5. public void onCreate(final Bundle savedInstanceState) {
  6.     super.onCreate(savedInstanceState);
  7.  
  8.    
  9.     setContentView(R.layout.main);
  10.     Button button1 = (Button) findViewById(R.id.button1);
  11.     button1.setText("click");
  12.    
  13.  
  14.     button1.setOnClickListener(new View.OnClickListener()  {
  15.         public void onClick(View v) {
  16.             // Perform action on clicks
  17.        
  18.                  Intent myIntent = new Intent(v.getContext(), CreateLineUpDB.class);
  19.              startActivityForResult(myIntent, 0);
  20.  
  21.  
  22.  
  23.     }}); }}
  24.    
Parsed in 0.032 seconds, using GeSHi 1.0.8.4

Can anyone help? Thanks


Hii
please post the list view code so that i can help you better. If you are using the setListAdapter then check if you have placed the " listview.setTextFilterEnabled(true);" or not if you didnot placed then write and test your code and get with results so that i can help you better.

sabs
sabs
Developer
Developer
 
Posts: 32
Joined: Fri Dec 04, 2009 2:55 pm

Postby achie1266 » Wed Dec 30, 2009 6:43 pm

change this line
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  Intent myIntent = new Intent(v.getContext(), CreateLineUpDB.class);
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
to
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  Intent myIntent = new Intent(Screen1.this, CreateLineUpDB.class);
Parsed in 0.035 seconds, using GeSHi 1.0.8.4
and see if it works. If not then also post your listActivity code.
achie
User avatar
achie1266
Master Developer
Master Developer
 
Posts: 223
Joined: Mon Nov 09, 2009 10:56 pm
Location: Denver

Postby SamB09 » Thu Dec 31, 2009 3:03 pm

There was a problem with my database thats why it wasn't displaying properly , thanks for the replies though :) .
SamB09
Developer
Developer
 
Posts: 39
Joined: Tue Oct 27, 2009 9:22 pm
Location: England

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 6 guests