[Solved] Dynamic inflating gives me a nullexception

I’ve change the type of view to resolve the problem: I had… //View newGratLayout = LayoutInflater.from(getActivity()).inflate(R.layout.albaran_invoices_row, ll_invoices_layer, false); And now I had… RelativeLayout newGratLayout = (RelativeLayout)getActivity().getLayoutInflater().inflate(R.layout.albaran_invoices_row, null); //rl_albaran_invoices_row Thank for the people how try to help me. solved Dynamic inflating gives me a nullexception

[Solved] Google Maps Api v2 Android Error

Because version 2 of the Google Maps Android API requires OpenGL ES version 2, you must add a element as a child of the manifest element in AndroidManifest.xml: <uses-feature android:glEsVersion=”0x00020000″ android:required=”true”/> This notifies external services of the requirement. In particular, it has the effect of preventing Google Play Store from displaying your app on devices … Read more

[Solved] Can you draw a google static map to a canvas after you download it?

As i mentioned in comments, You could actually reuse the bitmap. You could also draw on canvas directly for date and time since the datetime bitmap will consume 160000 bytes i.e 156kb. I have not tested the code. This is just a suggestion. class TheTask extends AsyncTask<Void, Void, Bitmap> { File mediaFile = new File(MenuScreen.mediaStorageDir.getPath() … Read more

[Solved] App crashes in Android Studio using Kotlin

You forget to typecast your TextView : Try with below code : val sample_text : TextView = findViewById<TextView>(R.id.sample_text) as TextView Full Code : import android.support.v7.app.AppCompatActivity import android.os.Bundle import android.widget.TextView import kotlinx.android.synthetic.main.activity_main.* class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val sample_text : TextView = findViewById<TextView>(R.id.sample_text) as TextView sample_text .text = “Happy … Read more

[Solved] How to use android distanceBetween() method

I am confused how to distinguish starting position and end position, as location manager gives you the current position and keeps giving back new position every 5s You already have the code available to get a new location, so you need to save the old Location and calculate distance to new location during every location … Read more

[Solved] passing json reply from webservice to variables

You are getting response in JSONObject and you are trying to get it in JSONArray.. thats why you are getting error.. Try this way… try { JSONObject result = new JSONObject(response); if(data.has(“ValidateLoginResult”){ JSONArray array = result.getJSONArray(“ValidateLoginResult”); for (int i = 0; i < array.length(); i++) { JSONObject obj = array.getJSONObject(i); String ErrorMessage= “”+obj.getString(“ErrorMessage”); String PropertyName= … Read more

[Solved] webview app permission for capturing images using camera and uploading images from gallery

Add in Manifest.xml: <uses-permission android:name=”android.permission.READ_EXTERNAL_STORAGE” /> <uses-permission android:name=”android.permission.WRITE_EXTERNAL_STORAGE” /> For android versions higher than M you have to ask for permissions, I’m referring to this question: Link solved webview app permission for capturing images using camera and uploading images from gallery

[Solved] Change EditText with Button click

In your MainActivity.java: public void onClicknews(View v) { String titel1 = “Trumps brutales Kalkül”; EditText article = (EditText) findViewById(R.id.articlename); String s = article.getText().toString(); Intent intent = new Intent(getApplicationContext(), NewsActivity.class); intent.putExtra(“articalName”,s); startActivity(intent); } In your NewsActivity.java: EditText news = (EditText) findViewById(R.id.news); String newsName = getIntent().getStringExtra(“articalName”); news.setText(newsName ); 0 solved Change EditText with Button click

[Solved] How to use shared preference data in different classes in android?

PREFS_NAME is the value you stored in shared preference. public static final String PREFS_NAME = “MyPrefsFile”; // Restore preferences SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); boolean silent = settings.getBoolean(“silentMode”, false) Look at Restoring preferences Edited:To use it among all classes i.e. setter getter method.Perfect use of OOPS.You can call the value from any class thats 1-line … Read more

[Solved] Use two components from different layouts

What you want to do is have two separate activities, one to edit the text, and one to display it. The first one you want to set the layout to layout_main, and set a callback for the button. Inside the callback you want: final EditText text = (EditText)findViewById(R.id.broj1); Intent intent = new Intent(MainAct.this, NumGen.class); Bundle … Read more

[Solved] How can I add one month to change into the milliseconds?

I suggest: First, instead of your variables (fields?) year, month, day, hours and minutes just declare private LocalDate date; private LocalTime time; private long milliseconds; (Keep the milliseconds variable since you will want to have your result here.) In onDateSet assign a value to date in this way: date = LocalDate.of(selectedYear, selectedMonth + 1, selectedDate); … Read more