Search Results

Search found 1255 results on 51 pages for 'todo'.

Page 27/51 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • How to get the computer name (hostname in a web aplication)?

    - by Filipe
    Hi, how can I get the client's computer name in a web application. The user in a network. Regards // Already tryed this option string IP = System.Web.HttpContext.Current.Request.UserHostAddress; string compName = DetermineCompName(IP); System.Net.IPHostEntry teste = System.Net.Dns.GetHostEntry(IP); ssresult = IP + " - " + teste.HostName; // TODO: Write implementation for action private static string DetermineCompName(string IP) { IPAddress myIP = IPAddress.Parse(IP); IPHostEntry GetIPHost = Dns.GetHostEntry(myIP); string[] compName = GetIPHost.HostName.ToString().Split('.'); return compName[0]; } All of that, gives me only the IP :/

    Read the article

  • Need to dynamically-generate a "sticky note" text

    - by gravyface
    Working on a website that has an image of a sticky note which will change text somewhat frequently (every month or so) as new "todo" items are created on it. Font I'm currently using is not Web Safe and the text is slightly angled to match the skew of the sticky note as well. Now I'm a pragmatist, and in situations like this I would normally secede defeat and opt for something more CSS/HTML practical. But no more! I'm falling a bit behind on what's going on with HTML5, CSS3, PNG graphics, Flash (ugh), and/or any other rich visuals. I'm decent with PHP/CSS/JS (jquery), have dabbled in Flash/actionscript too. My question is: what tools/method should I be looking at here?

    Read the article

  • Add up values from a text file

    - by Stanley
    Hi Guys I have a text file that contains Amounts at Substring (34, 47) of each line. I need to sum Up all the Values to the End of the File. I have this code that I had started to build but I do not know how to proceed from here: public class Addup { /** * @param args the command line arguments */ public static void main(String[] args) throws FileNotFoundException, IOException { // TODO code application logic here FileInputStream fs = new FileInputStream("C:/Analysis/RL004.TXT"); BufferedReader br = new BufferedReader(new InputStreamReader(fs)); String line; while((line = br.readLine()) != null){ String num = line.substring(34, 47); double i = Double.parseDouble(num); System.out.println(i); } } } The output is like this: 1.44576457E4 2.33434354E6 4.56875685E3 The Amount is in two decimal Places and I need the result also in the Two decimal Places. What Is the Best way to achieve this?

    Read the article

  • Issue with webview with emulator and some devices Android

    - by Yasir Khan
    I am developing an application that is focuses on on WebView i am loading map from a webpage and calling subsequent java script request on it but i do not know what is happening with Galaxy Tab 7' and my emulator too after running well first time if i visit the application again its just showing blank page. Code: mMapView = (WebView) findViewById(R.id.mapview); mMapView.clearCache(true); mMapView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); mMapView.getSettings().setJavaScriptEnabled(true); mMapView.loadUrl(mapurl); mMapView.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) { Log.e("Page loading","Url is :"+url); } @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { // TODO Auto-generated method stub view.loadUrl(url); return true; } }); initially i thought its a cache problem and i added clearcache() without any help. :-(

    Read the article

  • Find host from ItemContainerGenerator.itemChanged Event

    - by Mohanavel
    I'm working on C# 4.0, WPF. I have three ListView, and all three control have the same ItemContainerGenerator_ItemsChanged" event. So my problem is, when ever the event triggered, i have to find the host. lst1.ItemContainerGenerator.ItemsChanged += new System.Windows.Controls.Primitives.ItemsChangedEventHandler(ItemContainerGenerator_ItemsChanged); lst2.ItemContainerGenerator.ItemsChanged += new System.Windows.Controls.Primitives.ItemsChangedEventHandler(ItemContainerGenerator_ItemsChanged); lst3.ItemContainerGenerator.ItemsChanged += new System.Windows.Controls.Primitives.ItemsChangedEventHandler(ItemContainerGenerator_ItemsChanged); void ItemContainerGenerator_ItemsChanged(object sender, System.Windows.Controls.Primitives.ItemsChangedEventArgs e) { //TODO: Find host and proceed. **REAL Problem** // ListViewItem's Visible property has been set based on the deletion button click, // So at one place i have to get the count of rows which are visible and proceed // with related buttons enable/disable operation. }

    Read the article

  • python unit testing os.remove fails file system

    - by hwjp
    Am doing a bit of unit testing on a function which attempts to open a new file, but should fail if the file already exists. when the function runs sucessfully, the new file is created, so i want to delete it after every test run, but it doesn't seem to be working: class MyObject_Initialisation(unittest.TestCase): def setUp(self): if os.path.exists(TEMPORARY_FILE_NAME): try: os.remove(TEMPORARY_FILE_NAME) except WindowsError: #TODO: can't figure out how to fix this... #time.sleep(3) #self.setUp() #this just loops forever pass def tearDown(self): self.setUp() any thoughts? The Windows Error thrown seems to suggest the file is in use... could it be that the tests are run in parallel threads? I've read elsewhere that it's 'bad practice' to use the filesystem in unit testing, but really? Surely there's a way around this that doesn't invole dummying the filesystem?

    Read the article

  • why can't I use "&&" in python to mean 'and'?

    - by Sergio Tapia
    Here's my code: # F. front_back # Consider dividing a string into two halves. # If the length is even, the front and back halves are the same length. # If the length is odd, we'll say that the extra char goes in the front half. # e.g. 'abcde', the front half is 'abc', the back half 'de'. # Given 2 strings, a and b, return a string of the form # a-front + b-front + a-back + b-back def front_back(a, b): # +++your code here+++ if len(a) % 2 == 0 && len(b) % 2 == 0: return a[:(len(a)/2)] + b[:(len(b)/2)] + a[(len(a)/2):] + b[(len(b)/2):] else: #todo! Not yet done. :P return I'm getting an error in the IF conditional. What am I doing wrong?

    Read the article

  • Scanner's Read Line returning NoSuchElementException

    - by Brian
    This is my first time using StackOverflow. I am trying to read a text file which consists of a single number one the first line. try { Scanner s = new Scanner(new File("HighScores.txt")); int temp =Integer.parseInt(s.nextLine()); s.close(); return temp; } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } However, I get an error: java.util.NoSuchElementException: No line found at java.util.Scanner.nextLine(Unknown Source) at GameStart.getHighScore(GameStart.java:334) at GameStart.init(GameStart.java:82) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source) I know that HighScores.txt is not empty, so why is this problem occuring? I tried using BufferedReader, and BufferReader.readLine() return null.

    Read the article

  • java.lang.OutOfMemoryError: unable to create new native thread for multiple threads

    - by Kaustubh Ranjan Singh
    static class solver implements Runnable { static calculator(problem){ //Some code if(condition) {solver s = new solver(newproblem); new Thread(s).start();} } Public solver(int newproblem) { this.problem = newproblem ; } public void run() { // TODO Auto-generated method stub calculator(promblem); } } i am having a big array maze of 100x100 and i am trying to solve it and i am getting an error java.lang.OutOfMemoryError: unable to create new native thread(after running a code for some times). How can solve this , How can i use ExecutorService i think that will solve the problem or i want something like thisIf Number of generated threads4K then stop the first 100 threads

    Read the article

  • how to implement a callback in runnable to update other swing class

    - by wizztjh
    I have a thread like this public class SMS { class Read implements Runnable { Read(){ Thread th = new Thread(this); th.start(); } @Override public void run() { // TODO Auto-generated method stub while (true){ Variant SMSAPIReturnValue = SMSAPIJava.invoke("ReadSMS"); if (SMSAPIReturnValue.getBoolean()){ String InNumber = SMSAPIJava.getPropertyAsString("MN"); String InMessage = SMSAPIJava.getPropertyAsString("MSG"); } } } } } How do I update the message to another GUI class in the same package(I understand how to put nested class to another package ....). Should I implement a callback function in SMS class? But how? Or should I pass in the Jlabel into the class?

    Read the article

  • how to create resources without VS C++ 2008 creating MFC files

    - by numerical25
    I am creating a WIN32 application and I want most of all my application events to be made through the message queue. But everytime I create a dialog box or any resource like that. The IDE auto generates code that I don't necessarily need. I believe it's MFC code not sure. here it is. // dlgChangeDevice.cpp : implementation file // #include "stdafx.h" #include "ZFXD3D.h" #include "dlgChangeDevice.h" // dlgChangeDevice dialog IMPLEMENT_DYNAMIC(dlgChangeDevice, CDialog) dlgChangeDevice::dlgChangeDevice(CWnd* pParent /*=NULL*/) : CDialog(dlgChangeDevice::IDD, pParent) { } dlgChangeDevice::~dlgChangeDevice() { } void dlgChangeDevice::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(dlgChangeDevice, CDialog) ON_CBN_SELCHANGE(IDC_COMBO5, &dlgChangeDevice::OnCbnSelchangeCombo5) END_MESSAGE_MAP() // dlgChangeDevice message handlers void dlgChangeDevice::OnCbnSelchangeCombo5() { // TODO: Add your control notification handler code here } Not sure what it is but I don't need it. I want to retrieve all my code through the dialog message queue. So what should I do ?? Just disregard it and delete it. Will a hurt anything by doing so ??

    Read the article

  • Google App Engine datastore-primary key

    - by megala
    Hi, I've created a table in the Google App Engine Datastore. It contains the following FIELDS(GROUPNAME,GROUPID,GROUPDESC). How do I set GROUPID as the primary key? My code is as follows: @Entity @Table(name="group" , schema="PUBLIC") public class Creategroup { @Basic private String groupname; @Basic private String groupid; @Basic private String groupdesc; public void setGroupname(String groupname) { this.groupname = groupname; } public String getGroupname() { return groupname; } public void setGroupid(String groupid) { this.groupid = groupid; } public String getGroupid() { return groupid; } public void setGroupdesc(String groupdesc) { this.groupdesc = groupdesc; } public String getGroupdesc() { return groupdesc; } public Creategroup(String groupname, String groupid, String groupdesc ) { // TODO Auto-generated constructor stub this.groupname = groupname; this.groupid = groupid; this.groupdesc = groupdesc; } }

    Read the article

  • Core Data strategy using in memory cache, or no core data at all?

    - by randombits
    I have a user interface where the user can check off a bunch of items from a tableview, almost like a todo list. The items are populated from a Core Data stack. I need to be able to take all of the items they're clicking through and put them into a "temporary" shopping cart. Once they're in the shopping cart, users can go through the list and remove the items, or just submit them to a server. The thing is, the selected items are temporary just like an internet based shopping cart. It's nothing something that gets persisted once the application closes. Once the view is no longer in display, I can assume that the shopping cart is safe to discard. What's the best way to approach this? Since the user is essentially clicking on instances that map back to a Core Data entity .. should I setup a different persistence store such as in memory and add that store to my managed object context?

    Read the article

  • When and why does an EventHandler require objects to be final?

    - by Michiel Borkent
    I have the following code from a GWT Project that is part of the onModuleLoad() method (similar to Java's main method, if you don't know GWT): final TextBox t1 = new TextBox(); final Label lt1 = new Label(); t1.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { // TODO Auto-generated method stub if (!(t1.getText().matches("\\w{2}-\\w{2}-\\w{2}"))) lt1.setText("Invalid."); else lt1.setText("OK."); } }); Why do the two local variables have to be final here?

    Read the article

  • Override onDraw to change how the drawing occurs (Android)

    - by Casebash
    I want to change how my UI elements display, so I am overriding onDraw. The following code allows me to change a View to be drawn using PorterDuff.Mode.DARKEN. Unfortunately, this method involves creating a bitmap the size of the entire screen, then drawing to it then drawing this large bitmap the main screen again, for each UI element. This isn't at all efficient. Is it possible to achieve this in a more effecient way? @Override protected void onDraw(Canvas canvas) { //TODO: Reduce the burden from multiple drawing Bitmap bitmap=Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Config.ARGB_8888); Log.e("tmp",canvas.getClipBounds().toString()); Canvas offscreen=new Canvas(bitmap); super.onDraw(offscreen); //Then draw onscreen Paint p=new Paint(); p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DARKEN)); canvas.drawBitmap(bitmap, 0, 0, p); }

    Read the article

  • Database with 5 Tables with Insert and Select

    - by kirbby
    hi guys, my problem is that i have 5 tables and need inserts and selects. what i did is for every table a class and there i wrote the SQL Statements like this public class Contact private static String IDCont = "id_contact"; private static String NameCont = "name_contact"; private static String StreetCont = "street_contact"; private static String Street2Cont = "street2_contact"; private static String Street3Cont = "street3_contact"; private static String ZipCont = "zip_contact"; private static String CityCont = "city_contact"; private static String CountryCont = "country_contact"; private static String Iso2Cont = "iso2_contact"; private static String PhoneCont = "phone_contact"; private static String Phone2Cont = "phone2_contact"; private static String FaxCont = "fax_contact"; private static String MailCont = "mail_contact"; private static String Mail2Cont = "mail2_contact"; private static String InternetCont = "internet_contact"; private static String DrivemapCont = "drivemap_contact"; private static String PictureCont = "picture_contact"; private static String LatitudeCont = "latitude_contact"; private static String LongitudeCont = "longitude_contact"; public static final String TABLE_NAME = "contact"; public static final String SQL_CREATE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + "(" + IDCont + "INTEGER not NULL," + NameCont + " TEXT not NULL," + StreetCont + " TEXT," + Street2Cont + " TEXT," + Street3Cont + " TEXT," + ZipCont + " TEXT," + CityCont + " TEXT," + CountryCont + " TEXT," + Iso2Cont + " TEXT," + PhoneCont + " TEXT," + Phone2Cont + " TEXT," + FaxCont + " TEXT," + MailCont + " TEXT," + Mail2Cont + " TEXT," + InternetCont + " TEXT," + //website of the contact DrivemapCont + " TEXT," + //a link to a drivemap to the contact PictureCont + " TEXT," + //a photo of the contact building (contact is not a person) LatitudeCont + " TEXT," + LongitudeCont + " TEXT," + "primary key(id_contact)" + "foreign key(iso2)"; and my insert looks like this public boolean SQL_INSERT_CONTACT(int IDContIns, String NameContIns, String StreetContIns, String Street2ContIns, String Street3ContIns, String ZipContIns, String CityContIns, String CountryContIns, String Iso2ContIns, String PhoneContIns, String Phone2ContIns, String FaxContIns, String MailContIns, String Mail2ContIns, String InternetContIns, String DrivemapContIns, String PictureContIns, String LatitudeContIns, String LongitudeContIns) { try{ db.execSQL("INSERT INTO " + "contact" + "(" + IDCont + ", " + NameCont + ", " + StreetCont + ", " + Street2Cont + ", " + Street3Cont + ", " + ZipCont + ", " + CityCont + ", " + CountryCont + ", " + Iso2Cont + ", " + PhoneCont + ", " + Phone2Cont + ", " + FaxCont + ", " + MailCont + ", " + Mail2Cont + ", " + InternetCont + ", " + DrivemapCont + ", " + PictureCont + ", " + LatitudeCont + ", " + LongitudeCont + ") " + "VALUES (" + IDContIns + ", " + NameContIns +", " + StreetContIns + ", " + Street2ContIns + ", " + Street3ContIns + ", " + ZipContIns + ", " + CityContIns + ", " + CountryContIns + ", " + Iso2ContIns + ", " + PhoneContIns + ", " + Phone2ContIns + ", " + FaxContIns + ", " + MailContIns + ", " + Mail2ContIns + ", " + InternetContIns + ", " + DrivemapContIns + ", " + PictureContIns + ", " + LatitudeContIns + ", " + LongitudeContIns +")"); return true; } catch (SQLException e) { return false; } } i have a DBAdapter class there i created the database public class DBAdapter { public static final String DB_NAME = "mol.db"; private static final int DB_VERSION = 1; private static final String TAG = "DBAdapter"; //to log private final Context context; private SQLiteDatabase db; public DBAdapter(Context context) { this.context = context; OpenHelper openHelper = new OpenHelper(this.context); this.db = openHelper.getWritableDatabase(); } public static class OpenHelper extends SQLiteOpenHelper { public OpenHelper(Context context) { super(context, DB_NAME, null, DB_VERSION); } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub db.execSQL(Contact.SQL_CREATE); db.execSQL(Country.SQL_CREATE); db.execSQL(Picture.SQL_CREATE); db.execSQL(Product.SQL_CREATE); db.execSQL(Project.SQL_CREATE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL(Contact.SQL_DROP); db.execSQL(Country.SQL_DROP); db.execSQL(Picture.SQL_DROP); db.execSQL(Product.SQL_DROP); db.execSQL(Project.SQL_DROP); onCreate(db); } i found so many different things and tried them but i didn't get anything to work... i need to know how can i access the database in my activity and how i can get the insert to work and is there sth wrong in my code? thanks for your help thats how i tried to get it into my activity public class MainTabActivity extends TabActivity { private Context context; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.maintabactivity); TabHost mTabHost = getTabHost(); Intent intent1 = new Intent().setClass(this,MapOfLight.class); //Intent intent2 = new Intent().setClass(this,Test.class); //Testactivity //Intent intent2 = new Intent().setClass(this,DetailView.class); //DetailView Intent intent2 = new Intent().setClass(this,ObjectList.class); //ObjectList //Intent intent2 = new Intent().setClass(this,Gallery.class); //Gallery Intent intent3 = new Intent().setClass(this,ContactDetail.class); mTabHost.addTab(mTabHost.newTabSpec("tab_mol").setIndicator(this.getText(R.string.mol), getResources().getDrawable(R.drawable.ic_tab_mol)).setContent(intent1)); mTabHost.addTab(mTabHost.newTabSpec("tab_highlights").setIndicator(this.getText(R.string.highlights),getResources().getDrawable(R.drawable.ic_tab_highlights)).setContent(intent2)); mTabHost.addTab(mTabHost.newTabSpec("tab_contacts").setIndicator(this.getText(R.string.contact),getResources().getDrawable(R.drawable.ic_tab_contact)).setContent(intent3)); mTabHost.setCurrentTab(1); SQLiteDatabase db; DBAdapter dh = null; OpenHelper openHelper = new OpenHelper(this.context); dh = new DBAdapter(this); db = openHelper.getWritableDatabase(); dh.SQL_INSERT_COUNTRY("AT", "Austria", "AUT"); } } i tried it with my country table because it has only 3 columns public class Country { private static String Iso2Count = "iso2_country"; private static String NameCount = "name_country"; private static String FlagCount = "flag_image_url_country"; public static final String TABLE_NAME = "country"; public static final String SQL_CREATE = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + "(" + Iso2Count + " TEXT not NULL," + NameCount + " TEXT not NULL," + FlagCount + " TEXT not NULL," + "primary key(iso2_country)"; public boolean SQL_INSERT_COUNTRY(String Iso2CountIns, String NameCountIns, String FlagCountIns) { try{ db.execSQL("INSERT INTO " + "country" + "(" + Iso2Count + ", " + NameCount + ", " + FlagCount + ") " + "VALUES ( " + Iso2CountIns + ", " + NameCountIns +", " + FlagCountIns + " )"); return true; } catch (SQLException e) { return false; } } another question is it better to put the insert and select from each table into a separate class, so i have 1 class for each table or put them all into the DBAdapter class?

    Read the article

  • How to inherit from the main class in java

    - by user225269
    I have two java classes. One is NewFrame.java where the forms(buttons, textfields) are located. And the other one is Main.java where I have put the connection string for mysql: Main.java looks like this: public class Main { /** * @param args the command line arguments */ public static void main(String[] args) throws Exception { // TODO code application logic here Class.forName("com.mysql.jdbc.Driver"); Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/employee_record", "root", "password"); PreparedStatement statement = con.prepareStatement("select * from employee"); ResultSet result = statement.executeQuery(); } } How do I inherit from the main.java so that the declarations in it would be universally accessible to the forms in NewFrame.java? Please help. Thanks

    Read the article

  • Changing background color in Android SDK by clicking a button does not work

    - by DavidNg
    I have a simple program which is able to change the background color after clicking a button, but it does not work public class ChangeBackgroundActivity extends Activity { /** Called when the activity is first created. */ Button blueButton; LinearLayout myLO; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); myLO=(LinearLayout)findViewById(R.layout.main); blueButton=(Button)findViewById(R.id.button1); blueButton.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { // TODO Auto-generated method stub myLO.setBackgroundColor(0x0000FF); //blue color code #0000FF } }); } }

    Read the article

  • Interface with generic parameters- can't get it to compile

    - by user997112
    I have an interface like so: public interface MyInterface<E extends Something1> { public void meth1(MyClass1<E> x); } and I have a subclass whose superclass implements the above interface: public class MyClass2<E extends Something1> extends Superclass{ public MyClass2(){ } public void meth1(MyClass1 x) { // TODO Auto-generated method stub } } superclass: public abstract class Superclass<E extends Something1> implements MyInterface{ MyClass1<E> x; protected E y; public Superclass(){ } } the problem is that the parameter for meth1() is supposed to be generic. If I do MyClass1 it doesn't like it and the only way I can get it to compile is by leaving out generic parameters- which feels wrong. What's going wrong?

    Read the article

  • XNA AdGameComponent does not draw

    - by Alex Shkor
    I have following code. But AddGameComponent doesn't draw. protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); var li = new LicenseInformation(); IsTrial = li.IsTrial(); if (IsTrial) { AdGameComponent.Initialize(this, AppID); Components.Add(AdGameComponent.Current); CreateAd(); } } private void CreateAd() { bannerAd = AdGameComponent.Current.CreateAd(AdUnitID, new Rectangle(x, y, width, height), true); AdGameComponent.Current.Enabled = true; } I have tried to set DrawOrder to 1000, but ads still doesn't work.

    Read the article

  • Not able to click on all the links in Selenium Webdriver.Only the first link gets clicked

    - by Kiran
    .i want to go to a frame in which some links are there....Once I come in to a fram.i want to click all the links one by one..using webdriver...below is the code i have written.plz suggest me public static void main(String[] args) { // TODO Auto-generated method stub WebDriver driver=new FirefoxDriver(); driver.get("http://timesofindia.indiatimes.com/home"); WebDriverWait wait= new WebDriverWait(driver,200); wait.until(ExpectedConditions.presenceOfElementLocated(By.id("riShop"))); driver.switchTo().frame("riShop"); List<WebElement> lst=driver.findElements(By.tagName("a")); for(inti=0;i<lst.size();i++){ lst.get(i).click(); driver.navigate().back(); } } } } In the above code....only the first link gets clicked and then i get exception like..unable to locate the next element.....NoSuchException plz suggest me something about it...

    Read the article

  • howto launch my application like MS-Office applications do using automation.

    - by Alan
    I am writing a c# application which references a separate dll which contains all the automation features i am trying to implement such as Application Object Model, doing all this by using delegates and events. What i want to be able todo is to reference my dll containing the application object model in a different process and for it to automatically launch my application, like MS-Word does when you call its application. Example: Microsoft.Office.Interop.Word.Application wordApp = new Microsoft.Office.Interop.Word.Application(); Word object model loads in the WinWord.exe running its own process how can i achieve this as well. Thanks in advance

    Read the article

  • Need help: input int from console and pass it into method in different class

    - by christophe
    i'm a beginner, Need help, Please!!! I want to read number "a" from console and then store them in variable to use as passing to a different class (different .java file). How do i code the 2 classes? thanks public class PassedInMethod{ private int a; . public PAssMethod(int a) { a = a; // TODO: where to get the a? System.out.println("a was passed in!"+a); } public class Mainclass{ public static void main( String args[] ){ Scanner input = new Scanner( System.in ); int a; System.out.print( "Enter your nember: " ); a = input.nextInt(); PassedInMethod(int a); }

    Read the article

  • How to change the position of a imageButton when onClick

    - by Amber
    I am trying to shift the position of a image button when on click. I tried the following but it crashes at "rlOut.addView(imgP, p);" I have no issues when running them in onCreate(). RelativeLayout.LayoutParams p = new RelativeLayout.LayoutParams(62, 62); ImageButton imgP = (ImageButton)findViewById(R.id.imgP); public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub LayoutParams par = (LayoutParams)imbBtn.getLayoutParams(); if(event.getAction()==MotionEvent.ACTION_DOWN) { Log.d("ok","down"); mX = (int) event.getX() - imbBtn.getWidth() / 2; mY = (int) event.getY() - imbBtn.getHeight() / 2; et1.setText("mX down: "+String.valueOf(mX)); et2.setText("mY down: "+String.valueOf(mY)); } else if (event.getAction()==MotionEvent.ACTION_UP) { Log.d("ok","up"); p.leftMargin=mX; p.rightMargin=mY; rlOut.addView(imgP, p); Log.d("ok","p"); }

    Read the article

  • XBox 360 Dashboard Plugins

    - by ChoccyButton
    Is it possible to create plug ins for the Xbox 360 dashboard? I was looking to turn the 360 into the hub for the family. So you could for example turn the xbox on, and there on the dashboard see all the families calendars merged, todo lists, grocery lists, birthdays etc. I can't see anybody talking about plugins for the dashboard around the net so I'm guessing you can't, but thought I'd check. Next option will be something like a net top running in the family room, but that means 2 devices then, one for gaming and one for the family functions

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >