Hi everybody! I'm developing a Root app and I want to add an AsyncTask that runs a Root command in background, and, onPreExecute and onPostExecute runs a processdialog. Can anybody teach me how to do it?
Enviado desde mi Galaxy Mini Plus 4G usando Tapatalk 2
DannyGM16 said:
Hi everybody! I'm developing a Root app and I want to add an AsyncTask that runs a Root command in background, and, onPreExecute and onPostExecute runs a processdialog. Can anybody teach me how to do it?
Enviado desde mi Galaxy Mini Plus 4G usando Tapatalk 2
Click to expand...
Click to collapse
I have seen another similar post of yours.
Here is a relatively simple way of showing and hiding a progress. There are a number of ways of doing this as you have probably already seen, this is just another way. Your ProgressBar (xml) needs to exist in your layout.
Code:
new AsyncTask<Void, Void, Void>() {
[user=439709]@override[/user]
protected void onPreExecute() {
((View) view.findViewById(R.id.your_progressbar_in_layout)).setVisibility(View.VISIBLE);
}
[user=439709]@override[/user]
protected Void doInBackground(Void... params) {
// Whatever you are executing off the UI thread
return null;
}
[user=439709]@override[/user]
protected void onPostExecute(Void result) {
((View) view.findViewById(R.id.your_progressbar_in_layout)).setVisibility(View.GONE);
}
}.execute();
Related
I want to create an update.zip file for a certain purpose and since it's quite a big thing, it'd be nice if I could comment on each step so that I don't get lost. Is it possible to add comments to an update.zip?
Yes it is.
Add such a line for every comment to your updater-script:
ui_print("Hello World!");
Regards
Mmm, I meant comments as text that I want to appear in the script, but I don't want to be ran or displayed.
For example:
Code:
ui_print("Hello World!");
[B]# this command shows the words "Hello World!" in the screen[/B]
Logseman said:
Mmm, I meant comments as text that I want to appear in the script, but I don't want to be ran or displayed.
For example:
Code:
ui_print("Hello World!");
[B]# this command shows the words "Hello World!" in the screen[/B]
Click to expand...
Click to collapse
yes should work
make sure u save the file in UNIX format
BTW why u posting this in Dev section? isnt this more suitable in General section?
Now that you mention it... I'll report it.
What do you mean, saving it in UNIX format?
Enviado desde mi R800i usando Tapatalk
Logseman said:
Now that you mention it... I'll report it.
What do you mean, saving it in UNIX format?
Enviado desde mi R800i usando Tapatalk
Click to expand...
Click to collapse
Make sure your using an edify script too. CWM no longer supporty ammend scripts.
Sent from my R800i using Tapatalk
Hi everyone. What's the best way to upload a file ?
ex file location "sdcard/mydir/example.txt"
thanks in advance
alessandrospa said:
Hi everyone. What's the best way to upload a file ?
ex file location "sdcard/mydir/example.txt"
thanks in advance
Click to expand...
Click to collapse
You should say whether you want to upload it to your own server, to a social network or to a cloud service.
Then people will be able to help you.
oh yes, sorry. I want upload it to a cloud(Dropbox or Google Drive)
alessandrospa said:
Hi everyone. What's the best way to upload a file ?
ex file location "sdcard/mydir/example.txt"
thanks in advance
Click to expand...
Click to collapse
As an example, for one of my projects, I am uploading an image (drawing.png) to my server. This is part of an AppEngine web app so first I get a url (responseUrl) that I can post to and then use a HttpClient to execute the post request:
Code:
HttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(responseUrl);
try
{
[INDENT]MultipartEntity entity = new MultipartEntity();
File image = new File(getFilesDir().toString() + "/drawing.png");
entity.appPart("data",new FileBody(image,"image/png"));
httpPost.setEntity(entity);
HttpResponse response = httpClient.execute(httpPost);[/INDENT]
}
catch(IOException ex)
{
[INDENT]Log.e("deScribe",e.getMessage()+"");[/INDENT]
}
Look at these:
https://www.dropbox.com/developers/core
https://developers.google.com/drive/
http://koklimabc.blogspot.de/2012/12/how-to-programatically-upload-file-from.html
They might help you. Good luck!
(And please be so kind to press the Thanks button whenever someone helps you.)
I always suggest amazon S3 to upload stuff Sorry if it's a bit OT
THIS IS GUIDE TO ADD DIFFERENT TRANSPARENCY LAVELS TO YOUR ANDROID APP...
JUST ADD THE FOLLOWING CODES TO YOUR APP AND U R DONE
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WindowManager.LayoutParams params = this.getWindow().getAttributes();
/**
* 0.8f sets the activity to 80% opaque;
* similarly if u decrease the float value then it will increase your transparency
*/
params.alpha = 0.8f;
}
AND IN YOUR MANIFEST FILE REPLACE "ANDROID THEME" WITH THESE LINES
android:theme="@android:style/Theme.Translucent.NoTitleBar"
OR SIMPLE CHOOSE TRANSLUCENT THEME FOR YOUR APP
I HAVE ATTACHED A " SAMPLE TRANSPARENCY " PROJECT ALONG WITH A SIMPLE COMPILED APK
Please add [GUIDE] to the title of the thread. I thought it was a question.
Please make it as a downloadable txt file...
Sent from my Xperia U using xda app-developers app
Now see the attachements for better understanding
Now i have attached a sample transparency project and a sample apk...
anurag.dev1512 said:
THIS IS GUIDE TO ADD DIFFERENT TRANSPARENCY LAVELS TO YOUR ANDROID APP...
JUST ADD THE FOLLOWING CODES TO YOUR APP AND U R DONE
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WindowManager.LayoutParams params = this.getWindow().getAttributes();
w.getDefaultDisplay().getSize(size);
/**
* 0.8f sets the activity to 80% opaque;
* similarly if u decrease the float value then it will increase your transparency
*/
params.alpha = 0.8f;
}
AND IN YOUR MANIFEST FILE REPLACE "ANDROID THEME" WITH THESE LINES
android:theme="@android:style/Theme.Translucent.NoTitleBar"
OR SIMPLE CHOOSE TRANSLUCENT THEME FOR YOUR APP
I HAVE ATTACHED A " SAMPLE TRANSPARENCY " PROJECT ALONG WITH A SIMPLE COMPILED APK
Click to expand...
Click to collapse
Tnx for the code. :good:
thanks for complement
a-ssassi-n said:
Tnx for the code. :good:
Click to expand...
Click to collapse
if u really liked my code then u will obviously like me transparent themed app...
https://play.google.com/store/apps/details?id=org.ultimate.tasker
anurag.dev1512 said:
if u really liked my code then u will obviously like me transparent themed app...
https://play.google.com/store/apps/details?id=org.ultimate.tasker
Click to expand...
Click to collapse
Already downloaded and used.
nice work.
anurag.dev1512 said:
if u really liked my code then u will obviously like me transparent themed app...
https://play.google.com/store/apps/details?id=org.ultimate.tasker
Click to expand...
Click to collapse
IDE says unknown variable w and size
Sent from my GT-S5570 using XDA Premium 4 mobile app
anurag.dev1512 said:
THIS IS GUIDE TO ADD DIFFERENT TRANSPARENCY LAVELS TO YOUR ANDROID APP...
JUST ADD THE FOLLOWING CODES TO YOUR APP AND U R DONE
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WindowManager.LayoutParams params = this.getWindow().getAttributes();
w.getDefaultDisplay().getSize(size);
/**
* 0.8f sets the activity to 80% opaque;
* similarly if u decrease the float value then it will increase your transparency
*/
params.alpha = 0.8f;
}
AND IN YOUR MANIFEST FILE REPLACE "ANDROID THEME" WITH THESE LINES
android:theme="@android:style/Theme.Translucent.NoTitleBar"
OR SIMPLE CHOOSE TRANSLUCENT THEME FOR YOUR APP
I HAVE ATTACHED A " SAMPLE TRANSPARENCY " PROJECT ALONG WITH A SIMPLE COMPILED APK
Click to expand...
Click to collapse
Hi Bro Can you please elaborate more on how to add these codes as I am not aware of this so can u please guide properly with steps to do.
Do i need any application on my laptop or mobile
pls reply
Thanks
That's for your own app only. So you don't need anything expect the normal developer stuff (eclipse or androidstudio). Then just add above to your Activity and below to your manifest.
arpitkh96 said:
IDE says unknown variable w and size
Sent from my GT-S5570 using XDA Premium 4 mobile app
Click to expand...
Click to collapse
hi bro... just see the attachments that i have attached along with with sample apk...
and line plzz make w.getDefaultDisplay().getSize(size); as a comment and u r done.....
EmptinessFiller said:
That's for your own app only. So you don't need anything expect the normal developer stuff (eclipse or androidstudio). Then just add above to your Activity and below to your manifest.
Click to expand...
Click to collapse
yeah bro theaming and modding of the app is done by the developer side and adjusting the transpareny of the app is one of the theming of your app and adds beauty..to your app..........
i am not able to get your question properly ...
you mean what kind of software u need to develop apps for android or what...
plzzz ask...
Hi XDA-Developers!
I need your help with this little problem, I hope that anybody could help me
I have an Activity with this:
Code:
LayoutInflater inflater = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mLinearLayout = (RelativeLayout)inflater.inflate(R.layout.systemoverlayout, null);
wm = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int width = displaymetrics.widthPixels;
int height = displaymetrics.heightPixels;
int PhoneHeight = height;
params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.FILL_PARENT,
PhoneHeight,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT |
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN |
WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
PixelFormat.TRANSLUCENT);
params.gravity = Gravity.CLIP_HORIZONTAL | Gravity.TOP;
wm.addView(mLinearLayout, params);
That displays a layout as a Window.
My problem is easy, How can I update the UI (change text of a TextView) when this window is showing?
When I try it with "***.setText("****");" I get Foce close.
Any Help?
Thank's and happy christmas!!
Enviado desde mi GT-S5570I usando Tapatalk 2
Any Help? Pleasee
Enviado desde mi GT-S5570I usando Tapatalk 2
Please post your LogCat!
If it's a view, you won't need to refresh anything, it's done automatically for you .
You normally don't get a FC on calling setText, make sure you have the correct view! So you'd call:
Code:
TextView tv = (TextView) findViewById(R.id.yourTextViewId);
tv.setText(R.string.yourText);
And for your errors make sure to read nikwen's awesome guide on debugging here.
EmptinessFiller said:
Please post your LogCat!
Click to expand...
Click to collapse
Sorry, I'm in mobile phone.
Enviado desde mi GT-S5570I usando Tapatalk 2
SimplicityApks said:
If it's a view, you won't need to refresh anything, it's done automatically for you .
You normally don't get a FC on calling setText, make sure you have the correct view! So you'd call:
Code:
TextView tv = (TextView) findViewById(R.id.yourTextViewId);
tv.setText(R.string.yourText);
And for your errors make sure to read nikwen's awesome guide on debugging here.
Click to expand...
Click to collapse
The error gives FC in the line that setText in the TextView.
tv.setText("Error"); //Here!!
Why? Any help?
Thank's!
Enviado desde mi GT-S5570I usando Tapatalk 2
DannyGM16 said:
The error gives FC in the line that setText in the TextView.
tv.setText("Error"); //Here!!
Why? Any help?
Thank's!
Click to expand...
Click to collapse
Well I'd guess it is a NullpointerException but without Logs it's not clear. How did you initialise the tv? If done right with findViewById, it should not be null. Please post some more code and read the debugging guide again!
Edit: You may need to call mLinearLayout.findViewById(...) instead of this.findViewById() if you still have that LinearLayout!
SimplicityApks said:
Well I'd guess it is a NullpointerException but without Logs it's not clear. How did you initialise the tv? If done right with findViewById, it should not be null. Please post some more code and read the debugging guide again!
Edit: You may need to call mLinearLayout.findViewById(...) instead of this.findViewById() if you still have that LinearLayout!
Click to expand...
Click to collapse
I SOLVED IT WITH FOR HELP!! Lot's of thanks friend!
DannyGM16 said:
I SOLVED IT WITH FOR HELP!! Lot's of thanks friend!
Click to expand...
Click to collapse
Great!
(and that is my 200th post )
SimplicityApks said:
Great!
(and that is my 200th post )
Click to expand...
Click to collapse
CONGRATULATIONS!!
Enviado desde mi GT-S5570I usando Tapatalk 2
Hi,
I am trying to kill an application using " ActivityManager.killBackgrounProcess()" but the application is not killed.
Could anyone please help on how to kill an application programatically ?
bharath87 said:
Hi,
I am trying to kill an application using " ActivityManager.killBackgrounProcess()" but the application is not killed.
Could anyone please help on how to kill an application programatically ?
Click to expand...
Click to collapse
Try finish();
vishal007 said:
Try finish();
Click to expand...
Click to collapse
That will only work if the app he is trying to kill is his own and is currently running .
If I get you right, you need to use
Code:
android.os.Process.killProcess(android.os.Process.myPid());
Read this similar question for further help.
SimplicityApks said:
That will only work if the app he is trying to kill is his own and is currently running .
If I get you right, you need to use
Code:
android.os.Process.killProcess(android.os.Process.myPid());
Read this similar question for further help.
Click to expand...
Click to collapse
I see
Try this:
finish();
System.exit(0);