Wednesday, April 17, 2013

[android help] Create A More Complex Soundboard


So I have created a basic soundboard but am now looking to update the sound board to version 2.0


I would like to have a soundboard where when somebody clicks on a button the soundboard plays a random sound in that particular category.


Here is my basic soundboard code........


Your help is very much appreciated.



package com.example.benandhollysoundboard;

import android.R.layout;
import android.app.Activity;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;

public class myMenu extends Activity {

MediaPlayer ben, holly, gaston, plum, queenthistle, kingthistle, robot, wiseoldelf, lucy;


ImageButton Ben, Holly, Gaston, Plum, Queenthistle, Kingthistle, Robot, Wiseoldelf, Lucy;



@Override
protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);
setContentView(R.Layout.activity_main);

Ben = MediaPlayer.create(this, R.raw.ben);

Ben = (ImageButton) findViewById(R.id.Ben);
Ben.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {

ben.start();
}
});

holly = MediaPlayer.create(this, R.raw.holly);

Holly = (ImageButton) findViewById(R.id.Holly);
Holly.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {

holly.start();
}
});

gaston = MediaPlayer.create(this, R.raw.gaston);

Gaston = (ImageButton) findViewById(R.id.Gaston);
Gaston.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {

gaston.start();
}
});

plum = MediaPlayer.create(this, R.raw.plum);

Plum = (ImageButton) findViewById(R.id.Plum);
Plum.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {

plum.start();
}
});

robot = MediaPlayer.create(this, R.raw.robot);

Robot = (ImageButton) findViewById(R.id.Robot);
Robot.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {

robot.start();
}
});

wiseoldelf = MediaPlayer.create(this, R.raw.wiseoldelf);

Wiseoldelf = (ImageButton) findViewById(R.id.Wiseoldelf);
Wiseoldelf.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {

wiseoldelf.start();
}
});

lucy = MediaPlayer.create(this, R.raw.lucy);

Lucy = (ImageButton) findViewById(R.id.Lucy);
Lucy.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {

lucy.start();
}
});

kingthistle = MediaPlayer.create(this, R.raw.kingthistle);

Kingthistle = (ImageButton) findViewById(R.id.Kingthistle);
Kingthistle.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {

kingthistle.start();
}
});

queenthistle = MediaPlayer.create(this, R.raw.queenthistle);

Queenthistle = (ImageButton) findViewById(R.id.Queenthistle);
Queenthistle.setOnClickListener(new View.OnClickListener() {

@Override
public void onClick(View v) {

queenthistle.start();
}
});
}
}


.

stackoverflow.comm

[android help] I'm unable to call a Fragment within onTabSelected of another Fragment that implements ActionTab Listener


I am trying to create a Fragment that has a ListView in the content section, as a default view. There are ActionBar tabs to this view. I'm able to create that so far.


The LaunchListFragment Code



public class LaunchListFragment extends ListFragment implements ActionBar.TabListener {
public static String LIST_TYPE = "invalid";
GenericListData g_data[] = null;
private ViewPager mViewPager;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View result = inflater.inflate(R.layout.fragment_launch_list,
container, false);

setActionTabs();
setList();
return (result);
}

public static LaunchListFragment newInstance(String type) {
LaunchListFragment frag = new LaunchListFragment();
Bundle args = new Bundle();
LIST_TYPE=type;

args.putString(LIST_TYPE, type);
frag.setArguments(args);

return (frag);
}


What I wanted is, when you click the onTabSelected(), would like to change the views and I am using PagerFragment with views generated using an FragmentPagerAdapter



@Override
public void onTabSelected(Tab tab, android.app.FragmentTransaction ft) {

getChildFragmentManager().beginTransaction()
.add(android.R.id.content,
new PagerFragment()).commit();
}


The trouble is, I can't use getChildFragmentManager or getFragmentManager to call the PagerFragment, I get compilation errors to change the PagerFragment to app.Fragment. Even if I change that, it still complaints.


I suspect there is some sort of clash between support.Fragment and app.Fragment.


Is there a different way of approach to acheive this other than using nested Fragments?


Any help appreciated.



.

stackoverflow.comm

[General] Text is converting to MMS automatically

My fiance's phone automatically converts my contact information into my contact, which makes the SMS convert into MMS. This slows down everything. We have deleted the entire thread, and all of each other's contact info, and tried to start over, but it just continues to default to that number. When I type in her tmomail.net number into my phone, it keeps the 2 threads separate (her tmomail and her phone number).

How can I fix this issue??


.

forum.xda-developers.com

[android help] Exception in charts4j while working on bar chart

android - Exception in charts4j while working on bar chart - Stack Overflow







Tell me more ×

Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

















I am working on an Android application. In my app I have to show a multicolor bar chart.So I Searched and get a sample solution.


link for charts4j example


But when I am running this sample project I am getting the following Exception.



FATAL EXCEPTION: main


java.lang.NoClassDefFoundError: com.googlecode.charts4j.Data


I tried to findout a solution But failed to find a solution. Please help me friends. Otherwise plese provide me a way to draw a multicolor bar graph.Like the belowenter image description here



















Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.










default






.

stackoverflow.comm

[General] Offline Website Image Capture


I made a purchase online utilizing my Razr this weekend and I saved the confirmation website page in my offline saved sites on my phone. I need to print a hard copy of this receipt and when I search on the device for the site I only find a .SKIA type file at the date and time of the purchase. I am assuming that this is the offline image of my save website, but now I can't figure out how to print it.

My phone attempts to search for a WIFI printer, but I don't have one available.

Is their a way to convert the .SKIA to a .pdf and then print it from my desktop or laptop?

Thank you very much for any and all direction with this problem.

Don



.

forum.xda-developers.com

[android help] android sqlite query search with "LIKE" error


I have been stuck on this one for the past couple of hours (sadly).


I am building an application with SQLite where the application can do all the flexible SQL commands. I am currently stuck on how to query from columns other than the ID.


my code for retrieving information from the second column of the table is like so:



public String nameSearch(String n) {
String[] columns = { KEY_ID, KEY_NAME, KEY_DESCRIPTION };
Cursor c = myDatabase.query(true, DATABASE_TABLE, columns, KEY_NAME + "LIKE '%"+n+"%'", null, null, null, null, null);
while(c != null){
c.moveToFirst();
String data = c.getString(1);
return data;
}
return null;
}


My code on the onClick command and this is in a seperate class to explain the context:



case R.id.nameSearchButton:
String n = etName.getText().toString();
try {
SQLControls controller = new SQLControls(this);
controller.nameSearch(n);
String gotName = controller.nameSearch(n).toString();
controller.close();
tvName.setText(gotName);
Log.d(TAG, " got " + gotName);
} catch (Exception e) {
e.printStackTrace();
Log.e(TAG, " error at " + e);
}
break;


I know it's more or less pretty simple, but I think there's one thing that I am not doing or not seeing that's kicking my behind. For additional info, the logCat information that displays is as such whenever you hit the button click:



04-16 23:49:14.616: W/KeyCharacterMap(596): No keyboard for id 0
04-16 23:49:14.616: W/KeyCharacterMap(596): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
04-16 23:49:17.680: W/System.err(596): java.lang.NullPointerException
04-16 23:49:17.685: W/System.err(596): at com.example.sqltest.SQLControls.nameSearch(SQLControls.java:175)
04-16 23:49:17.685: W/System.err(596): at com.example.sqltest.CustomSearch.onClick(CustomSearch.java:72)
04-16 23:49:17.685: W/System.err(596): at android.view.View.performClick(View.java:2485)
04-16 23:49:17.685: W/System.err(596): at android.view.View$PerformClick.run(View.java:9080)
04-16 23:49:17.685: W/System.err(596): at android.os.Handler.handleCallback(Handler.java:587)
04-16 23:49:17.685: W/System.err(596): at android.os.Handler.dispatchMessage(Handler.java:92)
04-16 23:49:17.685: W/System.err(596): at android.os.Looper.loop(Looper.java:130)
04-16 23:49:17.685: W/System.err(596): at android.app.ActivityThread.main(ActivityThread.java:3683)
04-16 23:49:17.685: W/System.err(596): at java.lang.reflect.Method.invokeNative(Native Method)
04-16 23:49:17.685: W/System.err(596): at java.lang.reflect.Method.invoke(Method.java:507)
04-16 23:49:17.685: W/System.err(596): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
04-16 23:49:17.685: W/System.err(596): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
04-16 23:49:17.685: W/System.err(596): at dalvik.system.NativeStart.main(Native Method)
04-16 23:49:17.685: E/Custom Search(596): error at java.lang.NullPointerException


Thanks a lot for your help. Everyone who has answered my questions thus far has been of significant assistance, even for things so simple and minute.



.

stackoverflow.comm

[General] Help with a mobile external sd card reader!!!


Your GF's phone supports a standard called "USB On The Go" or simply OTG which allows it to read external USB devices such as hard drives, thumb drives, card readers, and mice / keyboard. The other two devices listed do not support this, so you won't be able to plug in any USB devices to them.



.

forum.xda-developers.com

[General] move pdanet (full paid version) onto new phone ?


If you got the full version on Google Play, you don't need to pay again, as long as the new phone is registered under the same Google account--it should just give you the option to install.

Sent from my DROID RAZR using Android Central Forums



.

forum.xda-developers.com

[android help] Android application architecture - fragments


Given the fact that I don't have very extensive experience when it comes to Android apps, I have a questions regarding the architecture of an application :


Are there any problems I can run into if I decide to create an application that has only one activity and I 'load' all the other content using fragments only ?


Thanks



.

stackoverflow.comm

[General] Fricken loodyads.


Do I have a virus, or is this something unavoidable?
I open up Chrome, go to either The Verge or Survivor Sucks (don't judge me!), and suddenly I'm redirected to loodyads.com and then to some game in Google Play.
It's really annoying.

Is this something hideous these sites ad providers is doing? Or have I installed some dodgy app?
And is there an Ad Filter app for Android? Surely there's a firewall of some sort which can filter out horrible URLs.



.

forum.xda-developers.com

[android help] how to access resources in a android library project


I am building an android library project which need some static resources(images/xml and etc) internally.


Then I wonder where I can put these resources and how to access them?


Since I put the resources in the assets folder. And I use the AssetManager to access the resources:



AssetManager am = Resources.getSystem().getAssets();
InputStream is;
try {
is = am.open("t.jpg");
Drawable dw = Drawable.createFromStream(is, null);
Bitmap bm = ((BitmapDrawable) dw).getBitmap();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.JPEG, 100, stream);
} catch (IOException e) {
e.printStackTrace();
}


However I got the error: W/System.err(19583): java.io.FileNotFoundException: t.jpg


What is the problem?



.

stackoverflow.comm

Google Voice on T-Mobile? [General]

Google Voice on T-Mobile? So I recently switched from a GNex on Verizon to a Moto X DE on T-Mobile. I had always used Google Voice for my v...