[android-developers] Button click Navigation not working ( application gets crashes)

2011-02-10 Thread Ramesh M
This is manifest.xml file:
?xml version=1.0 encoding=utf-8?
manifest xmlns:android=http://schemas.android.com/apk/res/android;
  package=button.pack
  android:versionCode=1
  android:versionName=1.0
application android:icon=@drawable/icon android:label=@string/
app_name
activity android:name=.Activity1
  android:label=@string/app_name
intent-filter
action android:name=android.intent.action.MAIN /
category
android:name=android.intent.category.LAUNCHER /
/intent-filter
/activity
activity android:name=.Activity2/activity
/application
uses-sdk android:minSdkVersion=8 /
/manifest

.

Java file: Activity1.Java


package button.pack;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class Activity1 extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.main);

Button next = (Button) findViewById(R.id.Button01);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(),
Activity2.class);
startActivityForResult(myIntent, 0);
}

});
}
}



Java file: Activity2.Java

package button.pack;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class Activity2 extends Activity {

/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);

Button next = (Button) findViewById(R.id.Button02);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent();
setResult(RESULT_OK, intent);
finish();
}

});

}
}



...


Xml Files...
main.xml..
?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent
android:background=#ff  

TextView
 android:layout_width=fill_parent
 android:layout_height=wrap_content
 android:textColor=#00
 android:text=This is Activity 2 /

Button
android:text=Previous
android:id=@+id/Button02
android:layout_width=250px
android:textSize=18px
android:layout_height=55px
/Button
/LinearLayout

main2.xml

?xml version=1.0 encoding=utf-8?
LinearLayout xmlns:android=http://schemas.android.com/apk/res/
android
android:orientation=vertical
android:layout_width=fill_parent
android:layout_height=fill_parent
android:background=#ff

 TextView
 android:layout_width=fill_parent
 android:layout_height=wrap_content
 android:textColor=#00
 android:text=This is Activity 1 /

 Button android:layout_width=250px
 android:textSize=18px
 android:layout_height=55px
 android:id=@+id/Button01
 android:text=Next
/Button

/LinearLayout
..

This my Logcat:


02-10 13:33:53.962: ERROR/AndroidRuntime(1756): FATAL EXCEPTION: main
02-10 13:33:53.962: ERROR/AndroidRuntime(1756):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{button.pack/button.pack.Activity1}:
java.lang.NullPointerException
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
1622)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:
1638)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
android.app.ActivityThread.access$1500(ActivityThread.java:117)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
android.os.Handler.dispatchMessage(Handler.java:99)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
android.os.Looper.loop(Looper.java:123)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
android.app.ActivityThread.main(ActivityThread.java:3647)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at
java.lang.reflect.Method.invokeNative(Native Method)
02-10 13:33:53.962: ERROR/AndroidRuntime(1756): at

[android-developers] Page Navigation Using button onclick in android

2010-12-23 Thread Ramesh M
Hi, Everyone,
  I have designed 3pages using 3xml files in layouts folder
android,each having 2 buttons previous page and next page..i was
loaded  first page using set content view , From here, through Button
onclick i have moved to second page.. till that  every thing was fine,
if try to go previous page or next page my application gets crashes,
forced to close...

Can any one give me the sample code for above scenario , Thanks in
Advance!!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Button Onclick Events-Page Navigation

2010-12-23 Thread Ramesh M
Hi, Everyone,
  I have designed 3pages using 3xml files in layouts folder
android,each having 2 buttons previous page and next page..i was
loaded  first page using set content view , From here, through Button
onclick i have moved to second page.. till that  every thing was fine,
if try to go previous page or next page my application gets crashes,
forced to close...

Can any one give me the sample code for above scenario , Thanks in
Advance!!

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] widgets

2010-12-03 Thread Ramesh M
Hi, can any one tell me about.. how to display widget in top of
application
i.e even if you working on some other application example typing text
in messages..
 the widget should display some portion on the application

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Android: widget App

2010-12-03 Thread Ramesh M
Hi,
  Can any one have code for Cricket scorecard widget application..

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en