Force close when trying to use BetterAsyncTask in droid-fu Android - android

I am currently trying to use the android library android fu to help me with my first proper app.
I am trying to makea test project using the droid fu library but when ever i go to test the app it force closes.
I have used an example of the asynctask and when i test the app it loads and does what its meant to but when i replace it with the betterasynctask the app force closes.
You can download the source of the test app from http://androidapp.dino-digital.com/DroidFuTest.zip

This is caused by you not providing a valid resource pointer for your dialog. Right after you instantiate the task -- try calling the task.disableDialog(); method. It should work after that.
EDIT: Seeing as the user wants a custom dialog -- I'd point you to this link. Just create a new custom dialog(or just use the Android's helper methods for creating a dialog) and reference that ID from your code.

Even though hwrdprkns was correct as to disabling the dialog will make the app work to be able to get the progress dialog to work i add to the following to get the dialog to work.
Call both lines to set the dialog content
super.setProgressDialogTitleId(R.string.dialog_title);
super.setProgressDialogMsgId(R.string.dialog_message);
OR
define "droidfu_progress_dialog_title" and droidfu_progress_dialog_message in your strings.xml

Related

I want Qt-app to look like Qt-app rather than Android-native

Due to removing upper bar (where clock, battery and other such things are situated) I have access to QtActivity.java.
I have tried to set
public String ENVIRONMENT_VARIABLES = "QT_USE_ANDROID_NATIVE_DIALOGS=0";
but without any result.
And there is one strange thing: on the first start of the app it looks like Android-app(ugly and curvy), but on the second run it starts looking like normal Qt-app.
I want program not to use Android styles from the start.
What can I do?
P.S. I use QWidgets, no QQuick/QML
Alas, but this method doesn't work under Android: Can I run a Qt application with a specific theme?
Just add this line to main()
QApplication::setStyle(QStyleFactory::create("Fusion"));
No need to edit AndroidManifest.xml or QtActivity.java

Add a warning if a method is not called in a specific class

So, what I'd like to achieve is:
I have a custom class which is basically a HttpRequest, I create the object with url, parameters, etc. And then I have to call execute() to execute it.
I was wondering, is there a way - by annotations, or whatever - to make Android Studio remind me to call this method?
I remember the was something similar with the android Toast, in the IDE a message like 'Did you forget to call show?' was shown if, in fact, I forgot to call show() after creating the Toast.
Thanks much to anyone who will help :)
You could try to create
Create a custom IntelliJ inspection
A custom LINT rule, if you want to check it on your build server and not on your local machine.

How to open an Activity on Keyguard android studio?

i have an App which is running good, but now i want to open that app on Keyguard
i mean while my phone is lock i can still able to open my app
like Camera App while the phone is call we can still use camera just like that i want to open my app without opening the lockscreen
help me what should i do to make this work
have edited the xml file
home_screen | keyguard
as a widget but its not working
can anyone help me on this !!
Run the str_ireplace code to insert the smilies after you use htmlspecialchars instead of before.
If you add htmlspecialchars() function after replacing the smileys with HTML Tags. It will not work correctly.
Output will be as
<strong>Name :</strong> I am Happy <img src="happy.png">
There are two solution to make it work.
Soln 1 :
Don't convert the text into emoticons before storing it in database. While showing it to the user.
First use htmlspecialchars(), then use strireplace().
Soln 2:
First convert the whole message using htmlspecialchars() , then convert the emoticons using strireplace(). After that, Store the result in the database.

Android Graphical UI Builders - Connect event

Maybe this question has been ask already, but could not find any answer for almost 2hours of internet search.
There is a graphical UI designer wich is coming along with the last android SDK.
Looks pretty cool and well done.
Nevertheless I * cannot find how to attach an event to the control through the graphical editor.
Of course I can add it manually into the xml, but in that case, what's the purpose of having such tool without that function ?
I mean all the other SDK I had in other languages always include that function.
I've also not been able to find doc about how to use this tool. Quite sad...
Thanks
If you want to add a click event handler, select the button (widget) in the GUI that you want to listen for, and look for the property onClick. Enter the name of the method you want to call when the user clicks on that widget, like.. onMyButtonClick
Then add the method to your Activity
public void onMyButtonClick(View v) {
// I heard the button click
}
The GUI builder is getting there, and is not yet as easy to use as the one in XCode, but it's not hard when you get used to it.

Unable to find components using the findViewById method in Android

I'm attempting to create an Activity and unfortunately every time I want to grab one of my XML components it gives me a RunTimeException (NullPointer).
Anytime I use code such as:
TextView tv = (TextView) findViewById(R.id.myView); //I get the exception
The same happens for any components I attempt to find with that method. I can't quite figure out why. I know it isn't due to the Activity not being in the Manifest because it's the only Activity in the test app I made. (The one set up by default).
Oddly I can still use setContentView(R.id.myView). It just doesn't seem to want to find anything when using the findViewById method.
Info that might be of use:
I am currently using NetBeans as my IDE.
I have done multiple 'clean and builds' as was suggested in another question. Android -findViewById question
Has anyone run into this issue before? If so, what was the solution?
If need be, I can provide sample code of when this is happening.
Don't pass in a view ID to setContentView, pass in a layout resource ID:
setContentView(R.layout.layout_name);
If you still have problems, post your layout file.
It is very sure that you R.java is not properly generated.
Delete R.Java in netbeans IDE and Re-build the project.
Hope it resolves your query.

Categories

Resources