Android parse open account error - java

i am trying to open a new account via parse.com :
https://www.parse.com/docs/android_guide
however when i get to the line :
user.setUsername("a");
then it show me a pop-up: "app must stopped..." and it exit
here is the logcat:
02-28 18:35:42.849: E/AndroidRuntime(1862): FATAL EXCEPTION: main
02-28 18:35:42.849: E/AndroidRuntime(1862): java.lang.ExceptionInInitializerError
02-28 18:35:42.849: E/AndroidRuntime(1862): at com.parse.ParseUser.stripAnonymity(ParseUser.java:327)
02-28 18:35:42.849: E/AndroidRuntime(1862): at com.parse.ParseUser.put(ParseUser.java:319)
02-28 18:35:42.849: E/AndroidRuntime(1862): at com.parse.ParseUser.setUsername(ParseUser.java:274)
02-28 18:35:42.849: E/AndroidRuntime(1862): at com.example.salebook.RegisterActivity$1.onClick(RegisterActivity.java:34)
02-28 18:35:42.849: E/AndroidRuntime(1862): at android.view.View.performClick(View.java:4204)
02-28 18:35:42.849: E/AndroidRuntime(1862): at android.view.View$PerformClick.run(View.java:17355)
02-28 18:35:42.849: E/AndroidRuntime(1862): at android.os.Handler.handleCallback(Handler.java:725)
02-28 18:35:42.849: E/AndroidRuntime(1862): at android.os.Handler.dispatchMessage(Handler.java:92)
02-28 18:35:42.849: E/AndroidRuntime(1862): at android.os.Looper.loop(Looper.java:137)
02-28 18:35:42.849: E/AndroidRuntime(1862): at android.app.ActivityThread.main(ActivityThread.java:5041)
02-28 18:35:42.849: E/AndroidRuntime(1862): at java.lang.reflect.Method.invokeNative(Native Method)
02-28 18:35:42.849: E/AndroidRuntime(1862): at java.lang.reflect.Method.invoke(Method.java:511)
02-28 18:35:42.849: E/AndroidRuntime(1862): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-28 18:35:42.849: E/AndroidRuntime(1862): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-28 18:35:42.849: E/AndroidRuntime(1862): at dalvik.system.NativeStart.main(Native Method)
02-28 18:35:42.849: E/AndroidRuntime(1862): Caused by: java.lang.RuntimeException: You must call Parse.initialize(context, oauthKey, oauthSecret) before using the Parse library.
02-28 18:35:42.849: E/AndroidRuntime(1862): at com.parse.ParseUser.checkApplicationContext(ParseUser.java:858)
02-28 18:35:42.849: E/AndroidRuntime(1862): at com.parse.ParseUser.getCurrentUser(ParseUser.java:731)
02-28 18:35:42.849: E/AndroidRuntime(1862): at com.parse.ParseUser.registerAuthenticationProvider(ParseUser.java:929)
02-28 18:35:42.849: E/AndroidRuntime(1862): at com.parse.ParseAnonymousUtils.initialize(ParseAnonymousUtils.java:42)
02-28 18:35:42.849: E/AndroidRuntime(1862): at com.parse.ParseAnonymousUtils.<clinit>(ParseAnonymousUtils.java:36)
02-28 18:35:42.849: E/AndroidRuntime(1862): ... 15 more
and here is my code ( i must say that "a" username doesnt exist in the server)
regbutton.setOnClickListener(new View.OnClickListener(){
#Override
public void onClick(View v) {
ParseUser user = new ParseUser();
user.setUsername("a");
user.setPassword("a");
user.setEmail("email#example.com");
try {
user.signUp();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
thanks

You must call Parse.initialize(context, oauthKey, oauthSecret) before using the Parse library.

Related

How to store a single row data into a string array of sqlite database in android

I have called a function returnCurrentNameById() by passing the id of the particular row. But it gives an error.
String[] s1;
public String[] returnCurrentNameById(int k) throws SQLException{
String[] columns = new String[]{ KEY_ID1, KEY_NAME, Key_DOB, KEY_AGE, KEY_PHONE_NO, Key_EXPERIENCE, KEY_EMAIL, KEY_STATUS, KEY_STATUS};
SQLiteDatabase db3 = this.getReadableDatabase();
Cursor c = db3.query(DATA_BASE_TABLE_NAME1, columns, KEY_ID1 + "=" + k, null, null, null, null);
if (c != null){
c.moveToFirst();
for(int i = 0; i<=8; i++){
s1[i] = c.getString(i);
}
return s1;
}
return null;
}
The Log cat error report is:
02-15 16:38:13.424 1545-1545/world.com.my`enter code here`progect09 D/AndroidRuntime﹕ Shutting down VM
02-15 16:38:13.464 1545-1545/world.com.myprogect09 W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x2bc9a300)
02-15 16:38:13.533 1545-1545/world.com.myprogect09 E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3591)
at android.view.View.performClick(View.java:4084)
at android.view.View$PerformClick.run(View.java:16966)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3586)
            at android.view.View.performClick(View.java:4084)
            at android.view.View$PerformClick.run(View.java:16966)
            at android.os.Handler.handleCallback(Handler.java:615)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4745)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
            at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at world.com.myprogect09.DataBaseSQL.returnCurrentNameById1(DataBaseSQL.java:209)
at world.com.myprogect09.ThirdActivity.isClicked(ThirdActivity.java:74)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at android.view.View$1.onClick(View.java:3586)
            at android.view.View.performClick(View.java:4084)
            at android.view.View$PerformClick.run(View.java:16966)
            at android.os.Handler.handleCallback(Handler.java:615)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4745)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
            at dalvik.system.NativeStart.main(Native Method)
02-15 16:38:34.491 1545-1545/world.com.myprogect09 I/Process﹕ Sending signal. PID: 1545 SIG: 9
You have not initialized your s1 array.
Use
s1 = new String[9];
to allocate an array of 9 elements.
Also check the return value of moveToFirst() so you don't get an exception in case the query returns no rows.
Replace
Cursor c = db3.query(DATA_BASE_TABLE_NAME1, columns, KEY_ID1 + "=" + k, null, null, null, null);
with
Cursor c = db3.query(DATA_BASE_TABLE_NAME1, columns, KEY_ID1 + " = ?", new String[]{String.valueOf(k)}, null, null, null);

NullPointerException but don't understand why

I have a DialogFragment which is supposed to display a VideoView and some TextViews. However, VideoView is null, along with other controls, even though the layout has been inflated.
Here is the code where I retrieve the pointer to various controls:
#Override
public void onViewCreated (View view, Bundle savedInstanceState) {
controls = new MediaController(getActivity());
title = (TextView) view.findViewById(R.id.title);
date = (TextView) view.findViewById(R.id.date);
description = (TextView) view.findViewById(R.id.description);
video = (VideoView) view.findViewById(R.id.video);
controls.setAnchorView(video);
video.setMediaController(controls);
}
But, debugger says otherwise:
Why are they null?
I have inflated the layout in create view where they are defined.
StackTrace:
08-04 06:19:07.804: E/AndroidRuntime(1758): FATAL EXCEPTION: main
08-04 06:19:07.804: E/AndroidRuntime(1758): java.lang.NullPointerException
08-04 06:19:07.804: E/AndroidRuntime(1758): at com.example.tqafragments.VideoDialog.showNewVideo(VideoDialog.java:61)
08-04 06:19:07.804: E/AndroidRuntime(1758): at com.example.tqafragments.MainActivity.feedItemSelected(MainActivity.java:36)
08-04 06:19:07.804: E/AndroidRuntime(1758): at com.example.tqafragments.FeedFragment$2.onItemClick(FeedFragment.java:73)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.widget.AdapterView.performItemClick(AdapterView.java:298)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.widget.AbsListView.performItemClick(AbsListView.java:1100)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2749)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.widget.AbsListView$1.run(AbsListView.java:3423)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.os.Handler.handleCallback(Handler.java:725)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.os.Handler.dispatchMessage(Handler.java:92)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.os.Looper.loop(Looper.java:137)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.app.ActivityThread.main(ActivityThread.java:5041)
08-04 06:19:07.804: E/AndroidRuntime(1758): at java.lang.reflect.Method.invokeNative(Native Method)
08-04 06:19:07.804: E/AndroidRuntime(1758): at java.lang.reflect.Method.invoke(Method.java:511)
08-04 06:19:07.804: E/AndroidRuntime(1758): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-04 06:19:07.804: E/AndroidRuntime(1758): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-04 06:19:07.804: E/AndroidRuntime(1758): at dalvik.system.NativeStart.main(Native Method)
ShowNewVideo:
public void showNewVideo(Feed f){
title.setText(f.getTitle());
date.setText(f.getDate());
description.setText(Html.fromHtml(f.getDescription()));
video.setVideoURI(Uri.parse(f.getVideoURL())); // Line 61
video.start();
}
you need to some change
put your code
title = (TextView) view.findViewById(R.id.title);
date = (TextView) view.findViewById(R.id.date);
description = (TextView) view.findViewById(R.id.description);
video = (VideoView) view.findViewById(R.id.video);
from onViewCreated() to onCreateView() then bind data on onViewCreated() method.

Trying to start an activity is causing an exception to be thrown, unsure why

Here is the code:
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = new ExpenseIcon(context);
((ExpenseIcon) convertView)
.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
System.out.println("Expense Icon Clicked");
Intent a = new Intent(context, ExpenseInput.class);
a.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP & Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(a);
}
});
}
if (image == null)
image = BitmapFactory.decodeResource(context.getResources(), R.drawable.dollar);
((ExpenseIcon)convertView).setImageBitmap(image);
return convertView;
}
When I click on the ExpenseIcon button I get an exception thrown at the line context.startActivity(a):
04-28 11:04:53.100: D/AndroidRuntime(24962): Shutting down VM 04-28
11:04:53.100: W/dalvikvm(24962): threadid=1: thread exiting with
uncaught exception (group=0x41ebc930) 04-28 11:04:53.130:
E/AndroidRuntime(24962): FATAL EXCEPTION: main 04-28 11:04:53.130:
E/AndroidRuntime(24962): android.util.AndroidRuntimeException: Calling
startActivity() from outside of an Activity context requires the
FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want? 04-28
11:04:53.130: E/AndroidRuntime(24962): at
android.app.ContextImpl.startActivity(ContextImpl.java:944) 04-28
11:04:53.130: E/AndroidRuntime(24962): at
android.app.ContextImpl.startActivity(ContextImpl.java:931) 04-28
11:04:53.130: E/AndroidRuntime(24962): at
android.content.ContextWrapper.startActivity(ContextWrapper.java:284)
04-28 11:04:53.130: E/AndroidRuntime(24962): at
com.example.mytestapp.controls.ExpenseIconGridGenerate$1.onClick(ExpenseIconGridGenerate.java:63)
04-28 11:04:53.130: E/AndroidRuntime(24962): at
android.view.View.performClick(View.java:4204) 04-28 11:04:53.130:
E/AndroidRuntime(24962): at
android.view.View$PerformClick.run(View.java:17355) 04-28
11:04:53.130: E/AndroidRuntime(24962): at
android.os.Handler.handleCallback(Handler.java:725) 04-28
11:04:53.130: E/AndroidRuntime(24962): at
android.os.Handler.dispatchMessage(Handler.java:92) 04-28
11:04:53.130: E/AndroidRuntime(24962): at
android.os.Looper.loop(Looper.java:137) 04-28 11:04:53.130:
E/AndroidRuntime(24962): at
android.app.ActivityThread.main(ActivityThread.java:5041) 04-28
11:04:53.130: E/AndroidRuntime(24962): at
java.lang.reflect.Method.invokeNative(Native Method) 04-28
11:04:53.130: E/AndroidRuntime(24962): at
java.lang.reflect.Method.invoke(Method.java:511) 04-28 11:04:53.130:
E/AndroidRuntime(24962): at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-28 11:04:53.130: E/AndroidRuntime(24962): at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 04-28
11:04:53.130: E/AndroidRuntime(24962): at
dalvik.system.NativeStart.main(Native Method)
I'm unsure why and not sure how to fix...
Try this,
Intent a = new Intent(context, ExpenseInput.class);
a.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(a);

parse android upload and download

i am using the services of parse.com, android guide:
https://www.parse.com/docs/android_guide
and it didnt work for me (i get a message: app must be closed...)
here is my code:
gameScore = new ParseObject("GameScore");
gameScore.put("score", 1337);
gameScore.put("playerName", "Sean Plott");
gameScore.put("cheatMode", false);
try {
gameScore.save();
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
gameScore.saveInBackground(new SaveCallback() {
public void done(ParseException e) {
// Access the object id here
objectId= gameScore.getObjectId();
}
});
ParseQuery query = new ParseQuery("GameScore");
query.getInBackground(objectId, new GetCallback() {
#Override
public void done(ParseObject parseObject, ParseException arg1) {
// TODO Auto-generated method stub
int score= parseObject.getInt("score");
Integer i =new Integer(score);
t1.setText(i.toString());
}
});
and here is the Logcat:
02-28 09:59:10.552: E/AndroidRuntime(773): FATAL EXCEPTION: main
02-28 09:59:10.552: E/AndroidRuntime(773): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.salebook/com.example.salebook.MainActivity}: java.lang.NullPointerException
02-28 09:59:10.552: E/AndroidRuntime(773): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
02-28 09:59:10.552: E/AndroidRuntime(773): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
02-28 09:59:10.552: E/AndroidRuntime(773): at android.app.ActivityThread.access$600(ActivityThread.java:141)
02-28 09:59:10.552: E/AndroidRuntime(773): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
02-28 09:59:10.552: E/AndroidRuntime(773): at android.os.Handler.dispatchMessage(Handler.java:99)
02-28 09:59:10.552: E/AndroidRuntime(773): at android.os.Looper.loop(Looper.java:137)
02-28 09:59:10.552: E/AndroidRuntime(773): at android.app.ActivityThread.main(ActivityThread.java:5041)
02-28 09:59:10.552: E/AndroidRuntime(773): at java.lang.reflect.Method.invokeNative(Native Method)
02-28 09:59:10.552: E/AndroidRuntime(773): at java.lang.reflect.Method.invoke(Method.java:511)
02-28 09:59:10.552: E/AndroidRuntime(773): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
02-28 09:59:10.552: E/AndroidRuntime(773): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
02-28 09:59:10.552: E/AndroidRuntime(773): at dalvik.system.NativeStart.main(Native Method)
02-28 09:59:10.552: E/AndroidRuntime(773): Caused by: java.lang.NullPointerException
02-28 09:59:10.552: E/AndroidRuntime(773): at com.example.salebook.MainActivity.onCreate(MainActivity.java:69)
02-28 09:59:10.552: E/AndroidRuntime(773): at android.app.Activity.performCreate(Activity.java:5104)
02-28 09:59:10.552: E/AndroidRuntime(773): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
02-28 09:59:10.552: E/AndroidRuntime(773): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
02-28 09:59:10.552: E/AndroidRuntime(773): ... 11 more
Also, when i am on debugging mode, i see that the objectId is null ,although i can see in the server that the object uploded succesfully with problem and it has a valid objectId.
Also, when i look in the gameScore object in eclipse i can see that it has the same objectId as in the server , however again it return me null in the objectId
thanks
So what is happening is you are executing saveInBackground which starts on a new thread. You will then immediately call query.getInBackground with a null objectId. You need to wait and call query.getInBackground AFTER the done call in gameScore.saveInBackground.
I would recommend moving the second call to the done function call in the gamerScore.saveInBackground execution above. Also you must consider that the save may fail so you will want to catch the exception as follows:
public void done(List<ParseObject> items, ParseException e) {
if (e == null) {
//execute query here
} else {
//handle exception here
}
}

Android Error: Unable To Start Activity

Here is the code I use to bring up the activity:
startActivity(new Intent(getApplicationContext(), Giveaway.class));
Here is the Activity that I am bringing up:
public class Giveaway extends Activity implements OnClickListener{
static SharedPreferences settings;
SharedPreferences.Editor prefEditor;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.giveaway);
settings = getSharedPreferences("firsttime", 0);
LinearLayout facebook = (LinearLayout)findViewById(R.id.facebooklayout);
Button later = (Button)findViewById(R.id.later);
Button dontshowagain = (Button)findViewById(R.id.dontshowagain);
facebook.setOnClickListener(this);
later.setOnClickListener(this);
dontshowagain.setOnClickListener(this);
}
public void onClick(View v) {
switch (v.getId()) {
case R.id.facebooklayout:
Uri localuri = Uri.parse("http://www.facebook.com/pages/Bright-Design/366832480049386");
startActivity(new Intent("android.intent.action.VIEW", localuri));
break;
case R.id.later:
finish();
break;
case R.id.dontshowagain:
finish();
prefEditor = settings.edit();
prefEditor.putBoolean("showgiveaway", false);
prefEditor.commit();
break;
}
}
I have declared the Activity in my manifest folder:
<activity
android:name=".Giveaway"
android:label="#string/app_name"
android:theme="#android:style/Theme.Dialog"
android:screenOrientation="portrait"/>
But I keep getting a java.lang.RuntimeException: Unable to start activity java.lang.NullPointerException error. Here is my logcat:
07-24 12:43:59.082: E/AndroidRuntime(7039): FATAL EXCEPTION: main
07-24 12:43:59.082: E/AndroidRuntime(7039): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.brightdesign.blackops2/com.brightdesign.blackops2.Giveaway}: java.lang.NullPointerException
07-24 12:43:59.082: E/AndroidRuntime(7039): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
07-24 12:43:59.082: E/AndroidRuntime(7039): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-24 12:43:59.082: E/AndroidRuntime(7039): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-24 12:43:59.082: E/AndroidRuntime(7039): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-24 12:43:59.082: E/AndroidRuntime(7039): at android.os.Handler.dispatchMessage(Handler.java:99)
07-24 12:43:59.082: E/AndroidRuntime(7039): at android.os.Looper.loop(Looper.java:123)
07-24 12:43:59.082: E/AndroidRuntime(7039): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-24 12:43:59.082: E/AndroidRuntime(7039): at java.lang.reflect.Method.invokeNative(Native Method)
07-24 12:43:59.082: E/AndroidRuntime(7039): at java.lang.reflect.Method.invoke(Method.java:521)
07-24 12:43:59.082: E/AndroidRuntime(7039): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-24 12:43:59.082: E/AndroidRuntime(7039): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-24 12:43:59.082: E/AndroidRuntime(7039): at dalvik.system.NativeStart.main(Native Method)
07-24 12:43:59.082: E/AndroidRuntime(7039): Caused by: java.lang.NullPointerException
07-24 12:43:59.082: E/AndroidRuntime(7039): at com.brightdesign.blackops2.Giveaway.onCreate(Giveaway.java:29)
07-24 12:43:59.082: E/AndroidRuntime(7039): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-24 12:43:59.082: E/AndroidRuntime(7039): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
You need to post your layout code, but what is most likely happening is that one of these three lines is returning a null value:
LinearLayout facebook = (LinearLayout)findViewById(R.id.facebooklayout);
Button later = (Button)findViewById(R.id.later);
Button dontshowagain = (Button)findViewById(R.id.dontshowagain);
In the debugger step through those lines and if one is null, there is your problem because as soon as you try to set the on click listener it is going to fail.
Caused by: java.lang.NullPointerException
at com.brightdesign.blackops2.Giveaway.onCreate(Giveaway.java:29)
Tells us that there is a NullPointerException in Giveaway.onCreate(), specifically Giveaway.java line 29. Odds are facebook, later, and/or dontshowagain is really null. Do you have all three of these defined in giveaway.xml?
Try this...
1.
Intent i = new Intent(Your_Activity.this, Another_Activity.class);
startActivity(i);
2. This below lines points to the class and the lines which are null.
Class:
com.brightdesign.blackops2/com.brightdesign.blackops2.Giveaway}: java.lang.NullPointerException
Lines:
Please check the below four lines, i think you are getting null value here.
Uri localuri = Uri.parse("http://www.facebook.com/pages/Bright-Design/366832480049386");
LinearLayout facebook = (LinearLayout)findViewById(R.id.facebooklayout);
Button later = (Button)findViewById(R.id.later);
Button dontshowagain = (Button)findViewById(R.id.dontshowagain);

Categories