Posts

android - String null pointer exception -

i have strange nullpointerexception @ app. i run code: protected void onpostexecute(void result) { log.i("name1", userprofilepictures[positionforpicture][0]); if(movedtoanotheractivity) return; if(loadnewposts && loaded10more == false) { firstlooppicture = true; positionforpicture = 0; return; } if((positionforpicture == userprofilepictures.length) == false) { new getuserpicture().execute(); int loadlength = loadedpostssaverforpictures.length; string name = userprofilepictures[positionforpicture][0]; log.i("name", name); } } ... ... ... and null pointer exception @ line: string name = userprofilepictures[positionforpicture][0]; log.i("name", name); log cat: 08-28 17:39:28.140: e/androidruntime(26801): fatal exception: main 08-28 17:39:28.140: e/androidruntime(26801): java.lang.nullpointerexception:...

c# - setting value's of a superclass (inheritence) -

i'm having trouble setting variables of superclass i have following classes: computer(superclass) laptop(subclass) desktop(subclass) in supperclass computer have variable string name; public class computer { protected string name; } when call method changename(string yourname) laptop class, should set variable name in superclass computer , this: public class laptop : computer { public void changename(string yourname) { name = yourname; } } when try name ,with properties, superclass computer , returns null . debugged see happend, , subclass laptop changed name in superclass, when method changename ended compiling, restored null . what may have caused this? i think setting variable laptop.changename(name); and trying name computer.name . you misunderstanding inheritance . obviously null . because computer , laptop 2 different objects. laptop inherited doe...

java - ClassCastException: android.widget.RelativeLayout cannot be cast to android.widget.TextView? -

i'm trying type cast data when write textview clickdata=(textview) view under onitemclick(...) logcat shows msg: java.lang.classcastexception: android.widget.relativelayout cannot cast android.widget.textview i don't know why. this belongs main activity: public class listviewforallcontact extends appcompatactivity { listview mylistview; protected void oncreate(bundle savedinstancestate){ super.oncreate(savedinstancestate); setcontentview(r.layout.listviewforallcontact); contactdatabase onbofcontactdatabase=new contactdatabase(getbasecontext()); cursor mcursor= onbofcontactdatabase.phonename(); string[] fromfilename=new string[]{contactdatabase.name}; int[] toviewid=new int[]{r.id.textview5}; simplecursoradapter simplecursoradapter; simplecursoradapter=new simplecursoradapter(this,r.layout.forreading,mcursor,fromfilename,toviewid,0); ...

android - ImageView width not matching parent -

Image
i'm trying have 3 sections under each others using linearlayout : <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:ads="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".imageediting"> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center" android:orientation="vertical"> <com.google.android.gms.ads.adview android:id="@+id/adviewofediting" android:layout_width="wrap_content" a...

r - trying to compare POSIXct objects in if statements -

i have within function: x <- as.posixct((substr((dataframe[z, ])$variable, 1, 8)), tz = "gmt", format = "%h:%m:%s") print(x) if ( (x >= as.posixct("06:00:00", tz = "gmt", format = "%h:%m:%s")) & (x < as.posixct("12:00:00", tz = "gmt", format = "%h:%m:%s")) ){ position <- "first" } but output: character(0) error in if ((as.numeric(departure) - as.numeric(arrival)) < 0) { : argument of length zero how can fix comparison works , prints correct thing? some examples of dataframe$variable column: 16:33:00 15:34:00 14:51:00 07:26:00 05:48:00 11:10:00 17:48:00 06:17:00 08:22:00 11:31:00 welcome stack overflow! first, reason you've gotten down votes because haven't given in question go on. 1 thing, haven't shown (dataframe[z, ])$variable is, makes hard formulate complete answer. seem trying ext...

Oracle Listener mess -

being newbie oracle 12c messed network setup while modifying memory_target setting, weird know happened somehow. the sid=oradb2 today listened on 1538 of host oracle12c.mydomain.com nicely. not. , don't know how port 1539 came picture. hope can me. here $oracle_home/network/admin/listener.ora file: listener1 = (description_list = (description = (address = (protocol = tcp)(host = oracle12c.mydomain.com)(port = 1538)) ) ) listener = (description_list = (description = (address = (protocol = tcp)(host = oracle12c.mydomain.com)(port = 1539)) (address = (protocol = ipc)(key = extproc1521)) ) ) here $oracle_home/network/admin/tnsnames.ora file oradb2 = (description = (address = (protocol = tcp)(host = oracle12c.omilia.com)(port = 1539)) (connect_data = (server = dedicated) (service_name = oradb2)) ) listener_oradb2 = (address = (protocol = tcp)(host = oracle12c.omilia.com)(port = 1538)) listener_oradb1 = (address = (pro...

php - Can't print stdClass property -

in following example, i'm trying print file_already_exists inside string, query, error: catchable fatal error: object of class stdclass not converted string in ... $db_items = (object) [ "cover" => (object) [ "file_already_exists" => 0, // can't print ], "file_already_exists" => 0, // can print ]; $str = "insert albums (file_on_system) values ('$db_items->cover->file_already_exists')"; echo $str; using $db_items->file_already_exists works fine, not $db_items->cover->file_already_exists . why that? there way print 1 in cover ? in simpler way echo "$db_items->file_already_exists"; // works echo "$db_items->cover->file_already_exists"; // doesn't work $str = "insert [...] values ('$db_items->cover->file_already_exists')"; the parser not know variable name ends, tries insert $db_items string - , caus...