Daily Archives

Articles indexed Saturday November 19 2011

Page 8/13 | < Previous Page | 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Best way to create neon glow line effect in AS3?

    - by Phil
    What's the best way to create a neon glow line effect in Flash AS3? Say similar to what's going on in the game gravitron360 on the xbox 360? Would it be a good idea to create movieclips with plain lines drawn in them and then apply a glow filter to them? or perhaps just apply the glow filter to the entire movieclip layer the movieclips are on? or just draw them manually and create a glow effect by converting the lines to fills and then softening edges? (wouldn't blend as well but would be the fastest CPU wise?) Thanks for any help

    Read the article

  • Converting from different handedness coordinate systems

    - by SirYakalot
    I am currently porting a demo from XNA to DirectX which, as I understand it, both have coordinate systems with different handednesses. What are the things I need to bare in mind when converting between the two? I understand not everything needs to be changed. Also I notice that many of the 3D maths functions in some of the direct3D libraries have right handed and left handed alternatives. Would it be better to just use these?

    Read the article

  • Path tables or real time searching for AI?

    - by SirYakalot
    What is the more common practice in commercial games; path lookup tables or real time searches? I've read that in many games path lookup tables are pre-calculated and baked into each map, so to speak, then steering behaviour is used to handle dynamic obstacles. or is it better practice to use optimised hierarchical A* searches? I understand the pro's and cons of each, I'm just curious as to what is most often used in the industry.

    Read the article

  • fmod getWaveData() export to WAVE file help (C++)

    - by eddietree
    I am trying to export the current sound that is being played by the FMOD::System into a WAVE file by calling getWaveData(). I have the header of the wave file correct, and currently trying to write to the wave file each frame like so: const unsigned int samplesPerSec = 48000; const unsigned int fps = 60; const int numSamples = samplesPerSec / fps; float data[2][numSamples]; short conversion[numSamples*2]; m_fmodsys->getWaveData( &data[0][0], numSamples, 0 ); // left channel m_fmodsys->getWaveData( &data[1][0], numSamples, 1 ); // right channel int littleEndian = IsLittleEndian(); for ( int i = 0; i < numSamples; ++i ) { // left channel float coeff_left = data[0][i]; short val_left = (short)(coeff_left * 0x7FFF); // right channel float coeff_right = data[1][i]; short val_right = (short)(coeff_right * 0x7FFF); // handle endianness if ( !littleEndian ) { val_left = ((val_left & 0xff) << 8) | (val_left >> 8); val_right = ((val_right & 0xff) << 8) | (val_right >> 8); } conversion[i*2+0] = val_left; conversion[i*2+1] = val_right; } fwrite((void*)&conversion[0], sizeof(conversion[0]), numSamples*2, m_fh); m_dataLength += sizeof(conversion); Currently, the timing of the sound is correct, but the sample seems clipped way harshly. More specifically, I am outputting four beats in time. When I playback the wave-file, the beats timing is correct but it just sounds way fuzzy and clipped. Am I doing something wrong with my calculation? I am exporting in 16-bits, two channels. Thanks in advance! :) Reference (WAVE file format): http://www.sonicspot.com/guide/wavefiles.html

    Read the article

  • The Correct Usage of DLLs with a DirectX Game?

    - by smoth190
    I'm using DirectX 10 (in C++) to make a game engine, and a test driver program on top of it. Now that I've written many messy rough drafts of an engine, I want to make the final (or sorta final) clean version. I choose to follow how I've seen other engines do it, and that's to have all the core nasty messy crap in a DLL, and then you can create games with just a few functions (well, not really :D). However, I'm unsure of what nasty messy crap to put in that DLL. I don't know about speed restrictions with DLLs. What I've done is put my winproc in the DLL, and have a class that takes the messages, and sends them through to the program using the DLL. Then that program does what it needs to do, and calls a rendering functions back in the DLL that renders everything. Only problem is it gets very low FPS (2, to be exact...). I've looked through everything, and I don't know if the way I'm using DLLs in causing this, or its something different. Whether it's the DLLs or not, I still want to know how to use a DLL correctly with a game engine. I like being neat, I hate having to see all those long names of DirectX classes. I use typedef a lot.

    Read the article

  • Can I suppress or enforce URLs to be prefaced with http:// in ALL browsers?

    - by Ryan Dunlap
    I want to ensure that regardless of what browser a user is in, they all see the EXACT same characters in the URL bar. Most browsers show the preceding protocol type in the URL bar. However, Chrome for example truncates http:// (not sure about https) and starts with the domain name, ie: Chrome: stackoverflow.com/questions/ask Safari: http://stackoverflow.com/questions/ask So, is there a way to either suppress the http:// in all browsers, or even enforce it in all browsers? Preferably suppress.

    Read the article

  • How can i sort my LinkList?

    - by user1054081
    **node *pre; node *curr; //int curr_roll=atoi(curr->rollnumber); node *temp_node; // store temporary data value for( pre = head ; pre!=NULL ; pre = pre->next ) { for( curr = pre->next ; curr!=NULL ; curr = curr->next ) { if(atoi(pre->rollnumber)>atoi(curr->rollnumber)) { temp_node=pre; pre=curr; curr=temp_node; } } }**

    Read the article

  • My images aren't updating immediately upon changing their src in javascript

    - by Dale
    I'm using the function below to change the img src. It's an array of ten images. When going through the loop, using break points, the images don't all update on the page immediately. Some of them do. If I inspect the unchanged images on the page (while paused at a breakpoint), the src has changed, but the image hasn't changed yet. All of the unchanged images get updated correctly when the function ends. Anyone know why they don't all get updated instantly and how I can force them to update? Also, is there a way I can hold off the updates of all of them until they're all reassigned and thus have them all update on the "simultaneously"? Here's my function. function mainFunction(){ finalSet = calculateSet(); for ( var int = 0; int < finalSet.length; int++) { var fileName = "cardImg" + (int); document.getElementById(fileName).src = "images/cards/" + finalSet[int].name + ".jpg"; } } Thanks for the help. Dale

    Read the article

  • Singleton method not getting called in Cocos2d

    - by jini
    I am calling a Singleton method that does not get called when I try doing this. I get no errors or anything, just that I am unable to see the CCLOG message. Under what reasons would a compiler not give you error and not allow you to call a method? [[GameManager sharedGameManager] openSiteWithLinkType:kLinkTypeDeveloperSite]; The method is defined as follows: -(void)openSiteWithLinkType:(LinkTypes)linkTypeToOpen { CCLOG(@"WE ARE IN openSiteWithLinkType"); //I NEVER SEE THIS MESSAGE NSURL *urlToOpen = nil; if (linkTypeToOpen == kLinkTypeDeveloperSite) { urlToOpen = [NSURL URLWithString:@"http://somesite.com"]; } if (![[UIApplication sharedApplication]openURL:urlToOpen]) { CCLOG(@"%@%@",@"Failed to open url:",[urlToOpen description]); [self runSceneWithID:kMainMenuScene]; } } HERE IS THE CODE TO MY SINGLETON: #import "GameManager.h" #import "MainMenuScene.h" @implementation GameManager static GameManager* _sharedGameManager = nil; @synthesize isMusicON; @synthesize isSoundEffectsON; @synthesize hasPlayerDied; +(GameManager*) sharedGameManager { @synchronized([GameManager class]) { if (!_sharedGameManager) { [[self alloc] init]; return _sharedGameManager; } return nil; } } +(id)alloc { @synchronized ([GameManager class]) { NSAssert(_sharedGameManager == nil,@"Attempted to allocate a second instance of the Game Manager singleton"); _sharedGameManager = [super alloc]; return _sharedGameManager; } return nil; } -(id)init { self = [super init]; if (self != nil) { //Game Manager initialized CCLOG(@"Game Manager Singleton, init"); isMusicON = YES; isSoundEffectsON = YES; hasPlayerDied = NO; currentScene = kNoSceneUninitialized; } return self; } -(void) runSceneWithID:(SceneTypes)sceneID { SceneTypes oldScene = currentScene; currentScene = sceneID; id sceneToRun = nil; switch (sceneID) { case kMainMenuScene: sceneToRun = [MainMenuScene node]; break; default: CCLOG(@"Unknown Scene ID, cannot switch scenes"); return; break; } if (sceneToRun == nil) { //Revert back, since no new scene was found currentScene = oldScene; return; } //Menu Scenes have a value of < 100 if (sceneID < 100) { if (UI_USER_INTERFACE_IDIOM() != UIUserInterfaceIdiomPad) { CGSize screenSize = [CCDirector sharedDirector].winSizeInPixels; if (screenSize.width == 960.0f) { //iPhone 4 retina [sceneToRun setScaleX:0.9375f]; [sceneToRun setScaleY:0.8333f]; CCLOG(@"GM: Scaling for iPhone 4 (retina)"); } else { [sceneToRun setScaleX:0.4688f]; [sceneToRun setScaleY:0.4166f]; CCLOG(@"GM: Scaling for iPhone 3G or older (non-retina)"); } } } if ([[CCDirector sharedDirector] runningScene] == nil) { [[CCDirector sharedDirector] runWithScene:sceneToRun]; } else { [[CCDirector sharedDirector] replaceScene:sceneToRun]; } } -(void)openSiteWithLinkType:(LinkTypes)linkTypeToOpen { CCLOG(@"WE ARE IN openSiteWithLinkType"); NSURL *urlToOpen = nil; if (linkTypeToOpen == kLinkTypeDeveloperSite) { urlToOpen = [NSURL URLWithString:@"http://somesite.com"]; } if (![[UIApplication sharedApplication]openURL:urlToOpen]) { CCLOG(@"%@%@",@"Failed to open url:",[urlToOpen description]); [self runSceneWithID:kMainMenuScene]; } } -(void) test { CCLOG(@"this is test"); } @end

    Read the article

  • How to reenable event.preventDefault?

    - by Richbits
    I have a web page which I have prevented the default action on all submit buttons, however I would like to re-enable default submit action on a button how can I do this? I am currently preventing the default action using the following: $("form").bind("submit", function(e){ e.preventDefault(); }); I have successfully done this using the following: $(document).ready(function(){ $("form:not('#press')").bind("submit", function(e){ e.preventDefault(); }); But can I do this dynamically when the button is clicked?

    Read the article

  • How to use database to generate multiple folder content page?

    - by VenomVipes
    Scenario :I am trying to build a Mobile Entertainment Portal. It will enable users to download Music & Movies to their Cell Phones... Problem Exp : Suppose I upload 100 folders of Songs, each folder is for one Album. I want a way to generate a page with all the folders name (Album Name) in it. If user click on the page, they should be taken to a page where they get list of all songs in the album. Clicking on any song name will let them download it. Can it be done anyway or will I have to manually design each of the 3 pages for each album. If I do that, its time consuming and also will be difficult to change anything like footer, header...

    Read the article

  • Poorly rendered text (NSFont) in MacRuby/Cocoa. Any advice?

    - by gnzlz
    I have a small MacRuby app that displays some text inside a NSTextView. I have a method called make_label() that builds an NSTextView with some text and returns it, which I use to add to another NSView via addSubview() make_label() looks like this: def make_label( x, y, width, height, color, font_size, text ) label = NSTextView.alloc.initWithFrame( NSMakeRect( x, y, width, height) ) font = NSFont.systemFontOfSize(font_size) label.setFont( font ) label.insertText( text ) label.setTextColor( color ) label.setDrawsBackground(false) label.setRichText(true) label.setEditable(false) label.setSelectable(false) label end My question is, how come my text looks so poorly rendered? It looks very pixelated and not antialiased at all (from what I can see). Click here for screenshot This screenshot shows 2 different sizes of the font, with the same phenomenon.

    Read the article

  • Path for a beginning web developer

    - by Trickerie
    I'm an experienced iOS programmer and have recently began to dabble in web development to expand my horizons. I've found it quite interesting and was wondering what learning path I should take through all the numerous languages. Here's what I planned on doing: HTML+CSS- PHP/Jquery Does that sound reasonable? Currently I'm nearly confident with my html/css abilities, and am planning to move ahead. Any good suggestions you guys could throw my way?

    Read the article

  • css: filters how to disable them for a certain class?

    - by jony
    On IE I'm having a bit of trouble with my CSS: body.transparent { background-color: transparent; color:#ffffff; text-shadow: 0 -1px #000, 1px 0 #000, 0 1px #000, -1px 0 #000; Filter:Glow(Color=#000000, Strength=1); } body.transparent a { text-shadow: none; filter: -;) } The glow filter needs to be excluded on body.transparent a, like the shadow is. But I just can't disable the filter for the the links. How do I do this??

    Read the article

  • How to implement HeightMap smoothing using Thrust

    - by igal k
    I'm trying to implement height map smoothing using Thrust. Let's say I have a big array ( around 1 million floats). A known graphics algorithm to implement the above problem is to calculate the average around a given cell. If for example I need to calculate the value at a given cell[i,j] what I will basically do is: cell[i,j] = cell[i-1,j-1] + cell[i-1,j] + cell[i-1,j+1] + cell[i,j-1] + cell[i,j+1] + cell[i+1,j -1] + cell[i+1,j] + cell[i+1,j+1] cell[i,j] /=9 That's the CPU code. Is there a way to implement it using thrust? I know that I could use the transform algorithm. But I'm not sure it's correct to access different cells which are occupied but different threads (banks conflicts and so on).

    Read the article

  • active record relations – who needs it?

    - by M2_
    Well, I`m confused about rails queries. For example: Affiche belongs_to :place Place has_many :affiches We can do this now: @affiches = Affiche.all( :joins => :place ) or @affiches = Affiche.all( :include => :place ) and we will get a lot of extra SELECTs, if there are many affiches: Place Load (0.2ms) SELECT "places".* FROM "places" WHERE "places"."id" = 3 LIMIT 1 Place Load (0.3ms) SELECT "places".* FROM "places" WHERE "places"."id" = 3 LIMIT 1 Place Load (0.8ms) SELECT "places".* FROM "places" WHERE "places"."id" = 444 LIMIT 1 Place Load (1.0ms) SELECT "places".* FROM "places" WHERE "places"."id" = 222 LIMIT 1 ...and so on... And (sic!) with :joins used every SELECT is doubled! Technically we cloud just write like this: @affiches = Affiche.all( ) and the result is totally the same! (Because we have relations declared). The wayout of keeping all data in one query is removing the relations and writing a big string with "LEFT OUTER JOIN", but still there is a problem of grouping data in multy-dimentional array and a problem of similar column names, such as id. What is done wrong? Or what am I doing wrong? UPDATE: Well, i have that string Place Load (2.5ms) SELECT "places".* FROM "places" WHERE ("places"."id" IN (3,444,222,57,663,32,154,20)) and a list of selects one by one id. Strange, but I get these separate selects when I`m doing this in each scope: <%= link_to a.place.name, **a.place**( :id => a.place.friendly_id ) %> the marked a.place is the spot, that produces these extra queries.

    Read the article

  • Using AChartEngine library for graphs, not able to get value for diffrent x-axis value

    - by kundan Chaudhary
    public static ArrayList<double[]> Value = new ArrayList<double[]>(); private double[] x = new double[10]; private double[] y = new double[10]; int counter = -1; add.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { counter++; x[counter] = Double.parseDouble(income_1.getText().toString()); y[counter] = Double.parseDouble(income_2.getText().toString()); income_1.setText(""); income_2.setText(""); } }); publish.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (Value != null) { Value.add(x); Value.add(y); Intent intent = salesStackedBarChart.execute(BarChart.this, Value, counter); startActivity(intent); } } }); //and in SalesStackedBarChart.java class public Intent execute(Context context, ArrayList<double[]> values ,int counter) { int count = counter + 1; double fcount = counter + 1.5; String[] titles = new String[] { "Android", "iPhone" }; int[] colors = new int[] { Color.GREEN, Color.CYAN }; XYMultipleSeriesRenderer renderer = buildBarRenderer(colors); setChartSettings(renderer, "Yearly revenue in the last "+count+" years", "Years", "revenue in $", 0.5, fcount, 0, 24000, Color.GRAY, Color.LTGRAY); renderer.setXLabels(count); renderer.setYLabels(10); renderer.setDisplayChartValues(true); renderer.setXLabelsAlign(Align.LEFT); renderer.setYLabelsAlign(Align.LEFT); renderer.setZoomRate(1.1f); renderer.setBarSpacing(0.5); return ChartFactory.getBarChartIntent(context, buildBarDataset(titles, values), renderer, Type.DEFAULT); } // in AbstractDemoChart.java class protected XYMultipleSeriesDataset buildBarDataset(String[] titles, List<double[]> values) { XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); int length = titles.length; for (int i = 0; i < length; i++) { CategorySeries series = new CategorySeries(titles[i]); double[] v = values.get(i); int seriesLength = v.length; for (int k = 0; k < seriesLength; k++) { series.add(v[k]); } dataset.addSeries(series.toXYSeries()); } return dataset; } Run this project i get graph with x- axis value: 1,2,3,4,5.... But I want to print value: 2005,2006,2007,2008..... I changed in some code like: setChartSettings(renderer, "Yearly revenue in the last "+count+" years", "Years", "revenue in $", 2005, 2010, 0, 24000, Color.GRAY, Color.LTGRAY); and run project i get value of x-axis like: 2005,2006,2007.... but not get graph bar value. Values of all x-axis are null. How can I make this work?

    Read the article

  • java unload static fields

    - by Alina Danila
    I have a java class that uses complex static fields which need special operations as close() so that they are safely cleaned by GC. For the initialization of static fields I use the static block. But I don't now how to unload the static field safely, so that I can call the close() method before the field is cleaned up by GC. Is there any way to unload a static field, similar to the static initialization block?

    Read the article

  • Translate Prototype code into Jquery version

    - by user1055495
    I everybody, I'm working on a SaaS application and I need to use Jquery instead of Prototype due to some extra plugins integration. My code that was wotking a charm with Prototype is not running anymore with Jquery and I'm not used to write in this framework... Is there someone to help me in "translating" this one: Thanks a lot for your help. var rates = new Array(); <% for tva_rate in @tva_rates -%> rates.push(new Array(<%= tva_rate.id %>, '<%=h tva_rate.taux %>', '<%=h tva_rate.compte_id %>' )); <% end -%> function tvaSelected() { tva_id = $('journal_tva_id').getValue(); show = 1; if (tva_id > 0){ rates.each(function(rate) { if (rate[0] == tva_id) { $('journal_taux').setValue(rate[1]); $('journal_compte_tva').setValue(rate[2]); show = 2; } }); } if (show == 1) { $('tva_taux_field').hide(); } else { $('tva_taux_field').show(); } } document.observe('dom:loaded', function() { tvaSelected(); $('journal_tva_id').observe('change', tvaSelected); });

    Read the article

  • Why is my code returning a Null Object Refrence error when using WatIn?

    - by Fuzz Evans
    I keep getting a Null Object Refrence Error, but can't tell why. I have a CSV file that contains 100 urls. The file is read into an array called "lines". public partial class Form1 : System.Windows.Forms.Form { string[] lines; public Form1() ... private void ReadLinksIntoMemory() { //this reads the chosen csv file into our "lines" array //and splits on comma's and new lines to create new objects within the array using (StreamReader sr = new StreamReader(@"C:\temp.csv")) { //reads everything in our csv into 1 long line string fileContents = sr.ReadToEnd(); //splits the 1 long line read in into multiple objects of the lines array lines = fileContents.Split(new string[] { ",", Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries); sr.Dispose(); } } The next part is where I get the null object error. When I try to use WatIn to go to the first item in the lines array it says I'm referencing a null object. private void GoToEditLinks() { for (int i = 0; i < lines.Length; i++) { //go to each link sequentially myIE.GoTo(lines[i].ToString()); //sleep so we can make sure the page loads System.Threading.Thread.Sleep(5000); } } When I debug the code it says that the GoTo request calls lines which is null. It seems like I need to declare the array, but don't I need to tell it an exact size to do that? Example: lines = new string[10] I thought I could use the lines.Length to tell it how big to make the array but that didn't work. What is weird to me is I can use the following code without problem: //returns the accurate number of urls that were in the CSV we read in earlier txtbx1.text = lines.Length; //or //this returns the last entry in the csv, as well as the last entry in the array TextBox2.Text = lines[lines.Length - 1]; I am confused why the array clearly has items in it, they can be called to fill a text box, but when I try to call them in my for loop it says its a null reference? UPDATE: By placing my cursor on both calls to lines and pressing f12 I find they both go to the same instance. The thought next is that I am not calling ReadLinksIntoMemory in time, below is my code: private void button1_Click(object sender, EventArgs e) { button1.Enabled = false; ReadLinksIntoMemory(); GoToEditLinks(); button1.Enabled = true; } Unless I'm mistaken the code says that the ReadLinksIntoMemory method must complete before GoToEditLinks can be called? If ReadLinksIntoMemory didn't finish in time I shouldn't be able to fill my text boxes with the lines array length and/or last entry. UPDATE: Stepping into the method GoToEditLinks() I see that lines is null before it calls: myIE.GoTo(lines[i]); but when it hits the goto command the value changes from null to the url it is suppose to go to, but at that same time it gives me the null object error? UPDATE: I added a IsNullOrEmpty check method and lines array passes it without any issue. I'm beginning to think it is an issue with WatIn and the myIE.GoTo command. I think this is the stack trace/call stack? Program.exe!Program.Form1.GoToEditLinks() Line 284 C# Program.exe!Program.Form1.button1_Click(object sender, System.EventArgs e) Line 191 + 0x8 bytes C# [External Code] Program.exe!Program.Program.Main() Line 18 + 0x1d bytes C# [External Code]

    Read the article

  • How to create and remove an html hidden field using jquery?

    - by ChickenBoy
    I am new to javascript and jquery so please bear with me. First of all here is my code so that you can test it to see whats wrong: http://jsfiddle.net/Lzw4e/1/ I want to create a new hidden field every time the user selects from the left <select> element and remove / destroy the hidden field when the user clicks the right <select> element. I used the jquery command $("<input type='hidden' value=selectedAddFootballPlayerId>"); but when I checked of firebug I can't see any hidden field being created. For removal of the hidden field I really don't know. Please help me. Thanks in advance.

    Read the article

  • Intellij UML diagram does not show one to many relationships

    - by Calm Storm
    I am trying to follow http://www.jetbrains.com/idea/features/uml_class_diagram.html I have a few classes so when I do Ctrl + Alt + U I only see all classes and just Extends relationships. Please note that I have set the "Diagrams" options in my settings to show one to many etc. I do not see One to One, One to Many relationships at all ? I have used JPA OneToOne Annotations and they dont turn up at all? Pressing Ctrl Shift F12 does not do anything? Can someone please explain?

    Read the article

  • Shuffling a list with a constraint

    - by 500
    Preparing a new psychophysic experiment, I have 48 original stimuli displayed 4 times (4 conditions). Resulting in 192 trials. Trying to randomize the order of presentation during the experiment, I need to maximize the distance between the 4 display of the same original stimuli. Please Consider : Table[{j, i}, {j, Range[48]}, {i, Range[4]}] Where j is the original stimuli number and i the condition Output Sample : {{1, 1}, {1, 2}, {1, 3}, {1, 4}, {2, 1}, {2, 2}, {2, 3}, {2, 4}, ... {47, 1}, {47, 2}, {47, 3},{47, 4}, {48, 1}, {48, 2}, {48, 3}, {48, 4}} How could I shuffle the order of presentation of those 192 items, maximizing the distance between identical item with regard to j the original stimuli number ?

    Read the article

  • Axis value changes in barchart while swapping the phone using Achartengine

    - by Vasu
    Hi I have included the Barchart using AchartEngine API .When I swap the orientation of the screen the yaxis value is altered as same values. For eg. initially it is (0,10) , (10,25) but after swapping its changes to (0,10), (10,10) i could not understand why it is happening . And I have place string in x axis instead of numbers , I used addtextlabel method but the string is overlapped on the number . I need to display only the names. could you help on this. I have included my code here. public class Analytics extends Activity implements OnClickListener { private Button settings_btn; private RelativeLayout relativeLayout3; private boolean isClicked = false; private static final int SERIES_NR = 1; static int multiple_of_five; private GraphicalView mChartView; XYMultipleSeriesRenderer renderer; static int value=20; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.analytics); settings_btn = (Button) findViewById(R.id.settings_btn); relativeLayout3 = (RelativeLayout) findViewById(R.id.relativeLayout3); settings_btn.setOnClickListener(this); if (SharedValues.isClicked) { relativeLayout3.setVisibility(View.VISIBLE); } else { relativeLayout3.setVisibility(View.GONE); } renderer = getBarDemoRenderer(); setChartSettings(renderer); if (mChartView == null) { RelativeLayout layout = (RelativeLayout) findViewById(R.id.relativeLayout5); // mChartView= ChartFactory.getLineChartView(this, getDemoDataset(), getDemoRenderer()); mChartView = ChartFactory.getBarChartView(getApplicationContext(),getBarDemoDataset(),renderer,Type.DEFAULT); layout.addView(mChartView,new LayoutParams(LayoutParams.FILL_PARENT, 280)); } else { mChartView.repaint(); } // Intent intent = ChartFactory.getLineChartIntent(this, getDemoDataset(), getDemoRenderer()); // intent = ChartFactory.getBarChartIntent(this, getBarDemoDataset(), renderer, Type.DEFAULT); // startActivity(intent); } @Override protected void onResume() { super.onResume(); } public XYMultipleSeriesRenderer getBarDemoRenderer() { XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); renderer.setAxisTitleTextSize(16); renderer.setChartTitleTextSize(20); renderer.setLabelsTextSize(15); renderer.setLegendTextSize(15); // renderer.setApplyBackgroundColor(true); // renderer.setBackgroundColor(R.color.chart_bg); // renderer.setMarginsColor(R.color.settings_bg_color); // renderer.setBackgroundColor(getResources().getColor(R.color.background)); renderer.setPanEnabled(false, false); renderer.setZoomEnabled(false, false); renderer.setMargins(new int[] {0, 10, 0, 0}); SimpleSeriesRenderer r = new SimpleSeriesRenderer(); // r.setColor(Color.MAGENTA); // renderer.addSeriesRenderer(r); r = new SimpleSeriesRenderer(); r.setColor(Color.CYAN); renderer.addSeriesRenderer(r); return renderer; } private void setChartSettings(XYMultipleSeriesRenderer renderer) { // renderer.setChartTitle("Chart demo"); // renderer.setXTitle("x values"); // renderer.setYTitle("y values"); renderer.setXAxisMin(2); renderer.setMarginsColor(Color.parseColor("#00F5DA81")); renderer.addXTextLabel(1.0, "Q1"); renderer.addXTextLabel(3.0, "Q2"); renderer.addXTextLabel(5.0, "Q3"); renderer.addXTextLabel(7.0, "Q4"); renderer.addXTextLabel(9.0, "Q5"); renderer.setXAxisMax(20); renderer.setYAxisMin(0); renderer.setYAxisMax(100); renderer.setZoomEnabled(false, false); // renderer.setApplyBackgroundColor(true); // renderer.setMarginsColor(R.color.settings_bg_color); renderer.setBackgroundColor(Color.TRANSPARENT); // renderer.setBackgroundColor(R.color.chart_bg); } private XYMultipleSeriesDataset getDemoDataset() { XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); final int nr = 10; Random r = new Random(); for (int i = 0; i < SERIES_NR; i++) { XYSeries series = new XYSeries(""); for (int k = 0; k < nr; k++) { if(k%2==1) { series.add(0, 0); } else { series.add(k, 20); } } dataset.addSeries(series); } return dataset; } private XYMultipleSeriesRenderer getDemoRenderer() { XYMultipleSeriesRenderer renderer = new XYMultipleSeriesRenderer(); renderer.setAxisTitleTextSize(6); renderer.setChartTitleTextSize(10); renderer.setLabelsTextSize(5); renderer.setLegendTextSize(5); renderer.setPointSize(5f); // renderer.setMarginsColor(R.color.settings_bg_color); // renderer.setApplyBackgroundColor(true); // renderer.setBackgroundColor(R.color.chart_bg); renderer.setMargins(new int[] {20, 30, 15, 0}); XYSeriesRenderer r = new XYSeriesRenderer(); r.setColor(Color.BLUE); r.setPointStyle(PointStyle.SQUARE); r.setFillBelowLine(true); r.setFillBelowLineColor(Color.WHITE); r.setFillPoints(true); renderer.addSeriesRenderer(r); r = new XYSeriesRenderer(); r.setPointStyle(PointStyle.CIRCLE); r.setColor(Color.GREEN); r.setFillPoints(true); renderer.addSeriesRenderer(r); renderer.setAxesColor(Color.DKGRAY); renderer.setLabelsColor(Color.LTGRAY); return renderer; } private XYMultipleSeriesDataset getBarDemoDataset() { XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset(); final int nr = 10; Random r = new Random(); for (int i = 0; i < SERIES_NR; i++) { CategorySeries series = new CategorySeries("Quadrant"); for (int k = 0; k < nr; k++) { value=value+5; // multiple_of_five=k+5; // Log.i("multiple_of_five", ""+multiple_of_five); // series.add(20 +multiple_of_five ); if(k%2==1){ series.add(value ); } else { series.add(0); } } dataset.addSeries(series.toXYSeries()); } return dataset; } @Override public void onClick(View v) { if (v == settings_btn) { if (SharedValues.isClicked) { relativeLayout3.setVisibility(View.GONE); SharedValues.isClicked = false; } else { relativeLayout3.setVisibility(View.VISIBLE); SharedValues.isClicked = true; } } } }

    Read the article

  • table row long press

    - by adoo42
    I have a table which is built dynamically based on how much data is present, if at all. I want to be able to long press anywhere on a the table row to be able to get some options to delete or edit etc. Is this possible? Remember I need to do all this without setting any XML as its dynamically built. Is this relevant to what I want to achieve? ` @override public boolean onKeyLongPress(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { // do your stuff here return true; } return super.onKeyLongPress(keyCode, event); } ` any advice is appreciated.

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13  | Next Page >