[Solved] Unexpected NullpointExpection inside a setter [duplicate]

The title is still null when you are calling mAlertDialog dialog = new mAlertDialog(); dialog.setTheTitle(getActivity().getString(R.string.invalidTimeTitle)); so what you can do is public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.dialog_invalid_time, container, false); title = (TextView)view.findViewById(R.id.titleText); setTheTitle(getActivity().getString(R.string.invalidTimeTitle)); return view; } // call it mAlertDialog dialog = new mAlertDialog(); dialog.show(fm, “InvalidTime”); 2 solved … Read more

[Solved] Getting a value of int from edittext

I think when you run your program then edit text have no value that means it will return NULL and NULL can’t be a Integer value so you must have to check Condition Like String editTextValue = number.getText().toString(); if(!TextUtils.isEmpty(editTextValue)){ angka = Integer.parseInt(editTextValue); } I hope its work for you. 3 solved Getting a value of … Read more

[Solved] How to show the input text view in Android

Edit: <RelativeLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:tools=”http://schemas.android.com/tools” android:layout_width=”fill_parent” android:layout_height=”fill_parent” android:background=”@color/myBackground” tools:context=”.MainActivity” android:selectAllOnFocus=”true”> <ImageView android:id=”@+id/imageView1″ android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_centerHorizontal=”true” android:layout_marginTop=”20dp” android:src=”https://stackoverflow.com/questions/16164469/@drawable/voicemeno” /> <TextView android:id=”@+id/userName” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_centerHorizontal=”true” android:layout_marginTop=”40dp” android:layout_below=”@+id/imageView1″ android:text=”User Name” android:textAppearance=”?android:attr/textAppearanceMedium” android:textColor=”@color/myText” /> <EditText android:id=”@+id/userNameInput” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_centerHorizontal=”true” android:layout_marginTop=”5dp” android:layout_below=”@+id/userName” android:ems=”10″ android:inputType=”textPersonName” android:textColor=”@color/myText” android:textCursorDrawable=”@null” > </EditText> <TextView android:id=”@+id/password” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:layout_centerHorizontal=”true” android:layout_marginTop=”40dp” android:layout_below=”@+id/userNameInput” android:text=”Password” android:textAppearance=”?android:attr/textAppearanceMedium” android:textColor=”@color/myText” /> <EditText android:id=”@+id/passwordInput” … Read more

[Solved] Cursor null exception in Samsung galaxy s3 [closed]

Cursor cursor = getContentResolver().query(imgPath, filePathColumn, null, null, null); if(cursor.getCount()>0){ cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); path = cursor.getString(columnIndex); } else{ Toast.makeText(getApplicationContext(), “Cursor Null”, Toast.LENGTH_SHORT).show(); } it obviously that getContentResolver().query return a null cursor. You need make sure the query(imgPath,filePathColumn, null, null, null) is correct, specially the imgPath solved Cursor null exception in Samsung galaxy s3 [closed]

[Solved] In google map using pinch to zoom in and zoom out with the current location as centre of the map

Create TouchableWrapper and use it in MapFragment public class TouchableWrapper extends FrameLayout { private GoogleMap mGoogleMap = null; public TouchableWrapper(Context context) { super(context); } public void setGoogleMap(GoogleMap googleMap) { mGoogleMap = googleMap; } @Override public boolean dispatchTouchEvent(MotionEvent event) { mScaleDetector.onTouchEvent(event); switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: mGoogleMap.getUiSettings().setScrollGesturesEnabled(true); long thisTime = System.currentTimeMillis(); if (thisTime – … Read more

[Solved] How to make launch of application

you must do some changes your manifest. Do changes in launcher or default activity like below: <activity android:name=”.MainActivity” android:configChanges=”keyboardHidden|orientation|keyboard|screenSize” android:windowSoftInputMode=”stateHidden”> <intent-filter> <action android:name=”android.intent.action.VIEW” /> <category android:name=”android.intent.category.BROWSABLE” /> <category android:name=”android.intent.category.DEFAULT” /> <data android:host=”yoursitedomain.com” android:scheme=”http” /> <data android:host=”www.yoursitedomain.com” android:scheme=”http” /> </intent-filter> </activity> BROWSABLE and data tags help you. 2 solved How to make launch of application

[Solved] What does ‘view’ container do in XML of Android

I think in this code, view application is clear: <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”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”> <android.support.design.widget.TabLayout android:id=”@+id/tabs” android:layout_width=”match_parent” android:layout_height=”?attr/actionBarSize” app:tabGravity=”fill” app:tabMode=”fixed” /> <View android:layout_width=”match_parent” android:layout_height=”1dp” android:background=”#c6c4c4″ /> <android.support.v4.view.ViewPager android:id=”@+id/viewpager” android:layout_width=”match_parent” android:layout_height=”match_parent” /> </LinearLayout> When view is in xml output will be: But without view in xml output will be: solved What … Read more

[Solved] What is timerSeekBar in this java code an object or variable?What is findViewById,

The method findViewById returns an instance of the class that is actually used to define that view in your XML file. (Seekbar) is used to cast that view with specific view. You have to cast that(findViewById) to the class that your variable is defined when you use it. So, This is the reason for SeekBar … Read more

[Solved] hosted landing page to download my app by platform/other

The solution provided by WebGuy is perfect. There is also an alternative with Branch. If you do not have a website, Branch offers a customizable Branch hosted page called Deepviews. With Deepviews you can provide your users with an opportunity to enter their mobile number so that they can text themselves Branch links to download … Read more

[Solved] How to solve this facebook key hash error?

public void generateHashkey(){ try { PackageInfo info = getPackageManager().getPackageInfo(PACKAGE, PackageManager.GET_SIGNATURES); for (Signature signature : info.signatures) { MessageDigest md = MessageDigest.getInstance(“SHA”); md.update(signature.toByteArray()); String s = Base64.encodeToString(md.digest(), Base64.NO_WRAP); Log.e(“HASH KEY “, s); } } catch (PackageManager.NameNotFoundException e) { Log.d(“Name not found”, e.getMessage(), e); } catch (NoSuchAlgorithmException e) { Log.d(“Error”, e.getMessage(), e); } } try to generate the … Read more

[Solved] Can the value of final static field change in android?

When you do this sEditor.putString(PREF_EMAIL,email);, the first parameter is the key and not the value. So what happens is in your preference the value of email is saved for the KEY PREF_EMAIL. Hence the key is never changing. Your shared preference are Key-ValuePair kind of collections. The value of String PREF_EMAIL is what you have … Read more

[Solved] How to format single textview like below in android without using \n or html format?

You can do it programmatically using this function val text = “This is my first text view this is my second textview this is my third textview” textView.text = proxyWifi.textFormation(text) copy/paste this code do your project 🙂 public String textFormation(String text){ String result = “”; String[] sentenceWords = text.split(” “); List<String> newSentenceWords = new ArrayList<>(); … Read more

[Solved] Click, Doble click and Hold Button

button.setOnLongClickListener and button.setOnClickListener should do the trick for long and single clicks respectively. For double tap here’s what I do in the setOnClickListener. boolean click=false; button.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { if(click==true) //DO SOMETHING new Handler().postDelayed(new Runnable(){ public void run(){ click=true; }, 1000}; }); solved Click, Doble click and Hold Button