android-layout

startActivityForResult should be used error only in dark mode

大憨熊 提交于 2021-01-28 11:20:54
问题 I am implementing dark mode on my app, and I am facing a peculiar(to me) problem. Below is the logcat of the crash, which I am facing only in dark mode , no error/warning in Light/Default (I am in SDK<=29 , so my default is battery saver) mode. Even when battery saver is on, i.e. the app is essentially in dark mode, this crash does not occur. Log of the error: 2020-02-20 11:20:59.726 16666-16666/com.example.trial E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.trial, PID: 16666

android.view.InflateException: Binary XML file line #9: Error inflating class com.jjoe64.graphview.helper.GraphViewXML

孤人 提交于 2021-01-28 10:14:01
问题 I have trouble getting my graph app to start on the Android emulator. "Unfortunately graph stopped" keeps on popping up. Can somebody help me fix this? Here is the Java file: package graphs.com.graphs; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class MainActivityG extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

android.view.InflateException: Binary XML file line #9: Error inflating class com.jjoe64.graphview.helper.GraphViewXML

霸气de小男生 提交于 2021-01-28 10:04:32
问题 I have trouble getting my graph app to start on the Android emulator. "Unfortunately graph stopped" keeps on popping up. Can somebody help me fix this? Here is the Java file: package graphs.com.graphs; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class MainActivityG extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

How to get an image resource by it's name in android? [duplicate]

Deadly 提交于 2021-01-28 07:04:26
问题 This question already has answers here : How to get a resource id with a known resource name? (10 answers) Closed 4 years ago . I want create a country and flag picker. I want to set an image of a flag, but i want to choose that image based on it's name. BAscially I am trying to create a flag and ISD code picker for android so that I can use it for adding ISD code before the phone numbers user. ImageView img1 = (ImageView)findViewById(R.id.imgFlag); img1.setBackgroundResource(R.drawable.India

How to create borderless button using style from style.xml file (along with all other styles)

*爱你&永不变心* 提交于 2021-01-28 07:02:50
问题 I am trying to create a borderless button, but I also have many other styles for my button and I want to design button borderless by embedding code into my style.xml file. One way I found was: By using style="?android:attr/borderlessButtonStyle" in my layout file. <Button android:id="@+id/button_send" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/button_send" android:onClick="sendMessage" style="?android:attr/borderlessButtonStyle" /> But I

Programmatically adding a layout + children

社会主义新天地 提交于 2021-01-28 06:31:58
问题 I'm currently learning the basics of Android programming. I'm able to create a static app with one page and a few buttons. The next step is learn to dynamically create apps, like i'm used to in webapplications. What i'm trying to do is create a simple facebook-like app with some timeline objects, with some text, a like button and the date it was placed. There is a simple NodeJS server which responds to a http GET request with a JSON file. Which is parsed and for each object in the array there

Custom ListView Adapter Null Object Reference

回眸只為那壹抹淺笑 提交于 2021-01-28 04:48:34
问题 Not sure what hasn't been initialised here, I'm guessing I have to manually create a new row on the list itself but I have no clue how to even start on that. Here is the code I use to create and call the adapter: /** * Retrieve adapter UI * * @param position current position with the list * @param convertView view * @param parent container * @return view, UI elements */ @Override public View getView(final int position, final View convertView, final ViewGroup parent) { final ViewHolder handler

Android Studio 3.1.3 does not show layout desing preview

て烟熏妆下的殇ゞ 提交于 2021-01-28 04:43:44
问题 It has passed some time since the last time I have created a new project in android studio and today when I did it the android studio does not show anything from the layout preview. Its a blank window and says "nothing to show". I already tried; updated the sdks tools, cleaned the project and rebuild it, invalidated and restarted caches, theme changes, and still nothing. Solution now i am using mac . 回答1: as my experience, switch to "Design".click "force refresh layout" 回答2: Did you update

Changing Locale at runtime not effecting fragments

老子叫甜甜 提交于 2021-01-28 03:05:47
问题 When user changes language i execute following code,it works fine for the present fragment in the activity, but if i go to other fragment, it partially updates the language, some strings gets updated and shows old language, and most importantly the date does not changes in inner fragments,and other activities. I tested this in nougat, marshmallow and oreo, and its happening in all of OS. When user changes the language i execute following. LocaleHelper.setLocale(getApplicationContext(),

expected resource of type color for R.attr.colorPrimary

早过忘川 提交于 2021-01-28 02:30:34
问题 I just want to set contentScrim programmatically. So I tried int color = ContextCompat.getColor(getActivity(), R.attr.colorPrimary); collapsingToolbarLayout.setContentScrimColor(color); Then I tried collapsingToolbarLayout.setContentScrimColor( getResources().getColor(R.attr.colorPrimary)); But I keep getting complaints about R.attr.colorPrimary . Any help with this? Someone seems to have ask this question Android - Should pass resolved color instead of resource id here: `getResources()