Need help in making a simple app - Java for Android App Development

Hello everyone ^_^
Ive been making zooper themes for some time, as well as Themer themes. What i would love to do now is to create an app that can install a zip file to a specific folder on the storage. I wish to make a Material themed app for installing the zip, that can show scereenshots or other shots which i use to display my themes. Also, I wish to include a link for the wallpaper for that specific theme. Ive scoured the internet a bit for this type of thing, and so far, ive been unable to find anything that would suit my requirement.
help would be appreciated a lot
PS, i havent done app developing or coding in a few years so you could say that im kinda noob to this now so guidance from scratch would be very helpful ^_^

You can use below code to create a zip and place it wherever you want.
Code:
private static void zipFolder(String inputFolderPath, String outZipPath) {
try {
FileOutputStream fos = new FileOutputStream(outZipPath);
ZipOutputStream zos = new ZipOutputStream(fos); File srcFile = new File(inputFolderPath);
File[] files = srcFile.listFiles();
Log.d("", "Zip directory: " + srcFile.getName());
for (int i = 0; i < files.length; i++) {
Log.d("", "Adding file: " + files[i].getName());
byte[] buffer = new byte[1024];
FileInputStream fis = new FileInputStream(files[i]); zos.putNextEntry(new ZipEntry(files[i].getName()));
int length;
while ((length = fis.read(buffer)) > 0) {
zos.write(buffer, 0, length); }
zos.closeEntry();
fis.close();
}
zos.close();
}
catch (IOException ioe) { Log.e("", ioe.getMessage());
}
}
And for the second one.
You can simple use intent to open your link in browser.
Intent n = new Intent(Intent.ACTION_VIEW , Uri.parse("link to your wallpaper"));
Sent from my A0001 using Tapatalk 2

Android Application Development Request
I am in need of some help I have a great idea for a new app that may change the face of advanced research. This will allow for the user to search all day and all night. While they are handling everyday life issues and events with family and what not. Yet still, allowing them to locate what they are looking for. Also will allow people with artifacts in there home. That the user may think is not worth anything yet it may be a goldmine. So instead of the user having to do research trying to locate these specific artifacts to see if they are worth money. This app will allow them to do advanced research all day with a touch of a button my idea is revolutionary when it comes to the advanced research that needs to be done. Please, I am looking for somebody to help me develop this app and bring it to life. So that I may present this idea to google for a possible sale. Thank you for your consideration ahead of time on helping me with this application.

Related

add new calendar event

please help ,
i'm trying to make an app which i need to add event to the phone calendar by development of-course, how can i start, any sample code, i'm new to android development
moamenam said:
please help ,
i'm trying to make an app which i need to add event to the phone calendar by development of-course, how can i start, any sample code, i'm new to android development
Click to expand...
Click to collapse
if there is any document i can read please support me with it, i really need to make my first android app
code snipped
Code:
private void SetCalenderEntry(String calID, long date, String subject, String body, String location)
{
ContentValues event = new ContentValues();
event.put("calendar_id", calID);
event.put("title", subject);
event.put("description", body);
event.put("eventLocation", location);
long startTime = date;
event.put("dtstart", startTime);
event.put("dtend", startTime);
Uri eventsUri = Uri.parse("content://calendar/events");
getContentResolver().insert(eventsUri, event);
}

Passing data from activity to Widget?

Hi.
I've been researching for many days. and i am really out of ideas.
First. I am new to all this.
Okay. my project:
I have:
- 1 Activity
- 1 Widget
So. my app is the widget itself. when you click the widget, it opens up the activity, the activity consists of a + and - button and a textview. the textview is on 0. when you click on +, you add up +1 to the textview and vica versa with the -.
So, what i want, in the activitys "onPause()", i want it to save the value and transfer it to the widget, i tried to send a broadcast, but that didnt work properly (i wanted to save the value in a hidden textview, but appwidget cant read values of TextViews -.-').
Also i tried some sql stuff.. didnt work either (appwidget doesnt support?)
Tried so save as a file on sd, didnt work (appwidget doesnt support?)
I couldnt use the broadcast thing because my app is made like this:
appwidget:
public void onUpdate(Context context,AppWidgetManager mgr,int[] appWidgetIds){
SetUp(context, mgr, appWidgetIds);
}
public void SetUp(Context c, AppWidgetManager mgr, int[] appWidgetIds){
//do stuff.....
}
public void onReceive(Context context, Intent intent) {
//If i get the number here, i cant really do anything with it, because i cant really save my value anywhere?
}
Bump. no one can help ?
I tried with the intent.putextra, but wont work.
If anyone wants to help me at msn, pm me. (eventually lightly paid)
Hi
Have you figured how to do it yet? I'm having the exact same problem and I'm unable to find any kind of solution.
Thank you!

[Q] Possible? Programatically distinguishing between home screen and phone app.

I am writing an app for research purposes, it logs what app you're currently using. I have most of it working correctly however I am running into an issue.
I am running into a problem because when the user is using the "Phone" application the process android.process.acore is the process in the Foreground UI (runningAppInfo.importance == RunningAppProcessInfo.IMPORTANCE_FOREGROUND). Then when the user is on their launcher or home screen the same behavior occurs with the only process in the Foreground UI being android.process.acore.
This means that I can't tell the difference between the two and that I can't properly log what app the user is using.
Any ideas or places in the code I should look?
Thanks
Hi,
have you already tried to look at the intents of the running application?
The following sample looks at the package level, but it could give you a direction.
I've written it for a prototype to test an idea that I've put aside, so I don't have experience with the different behaviors in the real world.
Code:
ActivityManager manager = (ActivityManager)<<CONTEXT>>.getSystemService(Context.ACTIVITY_SERVICE);
PackageManager pMan = <<CONTEXT>>.getPackageManager();
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
homeIntent.addCategory(Intent.CATEGORY_HOME);
List<ResolveInfo> homeApps = pMan.queryIntentActivities(homeIntent, PackageManager.GET_ACTIVITIES);
//returns the most recent running task
List<ActivityManager.RunningTaskInfo> runningTasks = manager.getRunningTasks(1);
Iterator<ActivityManager.RunningTaskInfo> iter = runningTasks.iterator();
while(iter.hasNext())
{
ActivityManager.RunningTaskInfo info = iter.next();
Iterator<ResolveInfo> homeAppIterator = homeApps.iterator();
while(homeAppIterator.hasNext())
{
ResolveInfo homeApp = homeAppIterator.next();
if(info.baseActivity.getPackageName().equals(homeApp.activityInfo.packageName))
//we have to deal with a home app
}
}
Thanks! Worked like a charm, here is my code to anyone else with this problem.
Code:
ActivityManager activityManager = (ActivityManager) getSystemService(Service.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> runningTasks = activityManager.getRunningTasks(1);
output = runningTasks.get(0).baseActivity.toShortString();
You have to add the android.permission.GET_TASKS permission in your manifest first.
Oh, I have been so focused on the home screen problem that I didn't notice that the solution to your root problem was solved on the way already.
I'm glad it helped.
Oh, and I noticed you were using iterators. You should check out the for each syntax in java, it would clean up your code a little. Feels very c++ with iterators .
Code:
List<ActivityManager.RunningTaskInfo> runningTasks = manager.getRunningTasks(1);
for (RunningTaskInfo runningTask : runningTasks) {
...
}
Just my personal preference when I'm coding .
GingerEffect said:
Oh, and I noticed you were using iterators. You should check out the for each syntax in java, it would clean up your code a little. Feels very c++ with iterators .
Code:
List<ActivityManager.RunningTaskInfo> runningTasks = manager.getRunningTasks(1);
for (RunningTaskInfo runningTask : runningTasks) {
...
}
Just my personal preference when I'm coding .
Click to expand...
Click to collapse
Thank you for that.
Coming from C# I really missed something like foreach (in addition to other beloved syntactic sugar)

Radial Menu Widget for android

Hi Devs,
I was recently working on a radial menu widget for android. Since I didn't find many references (other than one), I thought of building my own. I am posting the link to download the library file and the tutorial. Please feel free to post back your comments for improvements.
You can also use it for any commercial project as it is free...just post a link of the app you will be using for..
Link
Link simply goes to link.com which cannot be found. First! :-D
Sent from my SPH-D710 using xda premium
The Real Sitek said:
Link simply goes to link.com which cannot be found. First! :-D
Sent from my SPH-D710 using xda premium
Click to expand...
Click to collapse
My bad...UPDATED :cyclops:
IMO, you should base the look off of the quick controls menu in the stock ICS Browser. It would be pretty damn awesome the look was inspired by that and PLUS it would match the android ICS UI perfectly.
Chew DZ said:
IMO, you should base the look off of the quick controls menu in the stock ICS Browser. It would be pretty damn awesome the look was inspired by that and PLUS it would match the android ICS UI perfectly.
Click to expand...
Click to collapse
Will update... :highfive:
I encourage you to keep this up, this surpasses mine with icons.
for text only menues, an idea would be to
Path arc = new Path();
arc.addArc();
canvas.drawTextOnPath();
This can be used with the right math to make a curved text appearance.
Heres my implementation:
http://dakunesu.dev.animuson.net/apps/radialExample.java
I discontinued mine as i had little to no use at the moment.
strider2023 said:
Hi Devs,
I was recently working on a radial menu widget for android. Since I didn't find many references (other than one), I thought of building my own. I am posting the link to download the library file and the tutorial. Please feel free to post back your comments for improvements.
You can also use it for any commercial project as it is free...just post a link of the app you will be using for..
Link
Click to expand...
Click to collapse
hi strider2023,
1st things first, great library, truly, saved me a lot of effort, looks pretty cool.
I'm currently implementing here in a project at work and I'm working directly on the source code (as I needed to customised a couple of stuff for specific needs), but I found some improvement on, and that's the reason for the post.
inside class RadialmenuWidget.java:
inside onTouchEvent(MotionEven e)
yuou're only detecting touches on the wedge itself, in my case here. the wedge will be a very soft 1 pixel width line and the icons is what the user will see and click, so I added the icon rectangle on the check, the first part is your current wedge point check, and after the OR checks for the point into the icon.
Code:
inWedge = helper.pntInWedge(eventX, eventY, xPosition, yPosition, MinSize, MaxSize, (i * slice) + start, slice)
|| iconRect[i].contains(eventX, eventY);
inside class RadialmenuWidget.java:
inside onDraw(Canvas c)
I've included code to set the proper drawable state for the icon, just after you get the Drawable from the resources so now when you click on the icon it change state appropriately.
Code:
if (f.equals(selected)) {
drawable.setState(new int[] { android.R.attr.state_pressed });
} else {
drawable.setState(new int[] { -android.R.attr.state_enabled });
}
inside the class RadialMenuItem:
the interface RadialMenuItemClickListener
I've changed it completely for two reasons, 1) method name better mimic android naming, 2) it receives the item back to make possible implement only one listener.
Code:
public interface RadialMenuItemClickListener {
public void onItemClick(RadialMenuItem item);
}
so then on the implementation I can do something like this and only have one listener object.
Code:
private RadialMenuItemClickListener menuClick = new RadialMenuItemClickListener() {
@Override
public void onItemClick(RadialMenuItem item) {
String name = item.getName();
Log.d(TAG, "Menu click: " + name);
if (name.equals("item1")) {
} else if (name.equals("item2")) {
}
}
};
hope it helps improving the library.

[Q] Animation for changing Textnumbers

Hi,
this is my first time here, hello every body!
Currently i develop a quiz-application on android min api11 and Java. I descripe the situation i need help for.
1. The Player choose the correct answer and get 100 scores
2. The scores are displayed in a TextView (RelativeLayout)
3. The update of the scores is no problem "findId --> setText()"
Know i want this step animate like a counter. The User have to see every Scorenumber until the end result (001,002,003,...100) very fast for about 3 seconds (Like a byte loader for downloads).
Iam not sure whats the best solution.
I spend a lot of time for searching forum-discussions, tutorials, etc. The Community have different opinions.
Using a thread.sleep in a for-loop, drawing a canvas for each number, ... additional there are different practieces and no informations about the ressources.
my question is: have somebody experience and tipps for the given problem?
Do u need more informations about the project?
thanks a lot and many greetings!
Torsten
I would use Handler#postDelayed() because then you don't need to worry about blocking the ui thread/communicating to the ui thread.
Just two variables like int score, displayScore and a Runnable like this:
if (displayScore < score) {
displayScore++;
TextView#setText(displayScore);
Handler#postDelayed(this; 20 /*try other values too*/);
}
Perfect
EmptinessFiller said:
I would use Handler#postDelayed() because then you don't need to worry about blocking the ui thread/communicating to the ui thread.
Just two variables like int score, displayScore and a Runnable like this:
if (displayScore < score) {
displayScore++;
TextView#setText(displayScore);
Handler#postDelayed(this; 20 /*try other values too*/);
}
Click to expand...
Click to collapse
Hi Emptiness,
this way is perfect! thank you very much.
Here is my final code
Code:
int score =100;
int displayScore;
Runnable newScore = new Runnable() {
public void run() {
TextView score=(TextView)findViewById(R.id.score);
score.setText(String.valueOf(displayScore));
if(displayScore < score){
displayScore++;
handler.postDelayed(this, 20);
}
}
};
newScore.run();
Thanks and have a nice day
Torsten

Categories

Resources